Counting in a loop (7a)
A counter is a variable set to 0 before a loop, then increased by 1 with Counter ← Counter + 1 each time the thing being counted happens.
Understanding Counting in a loop (7a) in IGCSE Computer Science Paper 2
What it does: The counter only increases when the IF condition is true, so only the marks being counted are added to the count. Initialise the counter once before the loop. If it is set to 0 inside the loop, it resets every time and the count is lost. The variable being changed goes on the left of the arrow. The new value, Count + 1, goes on the right. A counter adds 1 for each event. Adding the entered values is called totalling, not counting. Count starts at 0 and goes up by 1 on each of the 5 repeats, so it ends at 5.
Common mistakes: A counter goes up by 1 each time, so it needs Counter ← Counter + 1. Subtracting 1 makes the counter go down instead of counting. A counter must be set to 0 before the loop starts. Starting at 1 makes the final count one too high. It should be Counter ← 0.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 47–57) and word search (Modules 47–70).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
Counter ← Counter + 1Fill in the Blanks
Spot the Error
Student with a class code? Join your class →