FOR loop with STEP (7a)
Used in a FOR loop to set how much the loop variable changes each time. STEP 2 counts in twos and STEP -1 counts down. The loop stops when the value goes past the end.
Understanding FOR loop with STEP (7a) in IGCSE Computer Science Paper 2
What it does: STEP -1 reduces the loop variable by 1 each time, so the loop counts down from 10 to 0. The loop stops when the value goes past the end value. 10 is greater than 9, so it is not used. The default STEP is 1, so FOR I ← 1 TO 5 counts 1, 2, 3, 4, 5. Counting up from 1 to 9 needs a positive step. A negative step moves the value in the wrong direction.
Common mistakes: The keyword is STEP, not STEPS. The line should be FOR Count ← 0 TO 10 STEP 2. To count down from 10 to 1 the step must be negative. With STEP 1 the value starts past the end, so the loop never runs. It should be STEP -1.
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 37–46) and word search (Modules 27–46).
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
STEPFill in the Blanks
Spot the Error
Student with a class code? Join your class →