FOR loop with STEP (7c)
Sets how much the FOR loop variable changes each time round. STEP 2 counts in twos and STEP -1 counts down. The loop stops when the value goes past the end value.
Understanding FOR loop with STEP (7c) in IGCSE Computer Science Paper 2
What it does: STEP 2 adds 2 to Number after each pass of the loop, so OUTPUT shows 2, 4, 6, 8 and 10. Without STEP the loop counts up by 1, so starting at 10 it is already past 1 and never runs. STEP -1 makes it count down. X goes 1, 3, 5, 7, 9. The next value is 11, which is past 10, so the loop stops. STEP comes after the end value: FOR variable ← value1 TO value2 STEP amount.
Common mistakes: NEXT must name the same loop variable that the FOR line uses. The loop variable is Number, so the line should be NEXT Number. Counting down from 5 to 1 needs a negative step. STEP 1 counts up, so the value is already past the end value and 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 166–175) and word search (Modules 166–187).
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 →