Looping through an array with FOR (7d)
A loop whose counter is the array index. Inside it, Marks[Index] picks each element in turn, so the loop visits every item from position 1 to 10 once.
Understanding Looping through an array with FOR (7d) in IGCSE Computer Science Paper 2
What it does: INPUT stores each typed value into Marks[Index], so the loop fills positions 1 to 10 one at a time. The counter goes through every position from 1 to 10, so each element of Marks is output exactly once. Cambridge arrays usually start at index 1, so a 10-item array has indexes 1 to 10. Starting at 0 would refer to an element that does not exist. Both the start value 1 and the end value 10 are included, so Index takes 10 values. Cambridge pseudocode closes a FOR loop with NEXT followed by the counter name. ENDFOR is not used.
Common mistakes: A FOR loop sets its counter with the assignment arrow ←, not =. It should be FOR Index ← 1 TO 10. The end value of a FOR loop follows the keyword TO, not UNTIL. UNTIL belongs to REPEAT loops. It should be FOR Index ← 1 TO 10.
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 275–285) and word search (Modules 275–295).
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
FOR Index ← 1 TO 10Fill in the Blanks
Spot the Error
Student with a class code? Join your class →