Cambridge O Level Computer Science · Syllabus 2210 · Programming
Counting
What is Counting?
Recording how many times something has happened by adding one to a variable each time an event occurs; the counter is initialised to zero before the loop and incremented only when its condition is satisfied.
This definition is part of the Programming chapter in Cambridge O Level Computer Science.
Counting in context
Totalling is accumulating values into a variable: Total ← Total + Value. Counting is recording how many times something happened: Count ← Count + 1. They look almost identical and are constantly confused, but they answer different questions — how much altogether? against how many? — and the value added is different: the data item for a total, always the number 1 for a counter. Both must be initialised to 0 before the loop, and a counter should be incremented only when its condition is satisfied.
Common mistakes with Counting
- M10. “Counting and totalling are the same operation.” TruthA total adds the data value: Total ← Total + Value. A counter adds one: Count ← Count + 1. They answer different questions. WatchA counter that answers “how many that…” must be inside the IF, not after ENDIF.

