Looping through an array with FOR (7c)
Uses the loop counter Index as the array index, so Names[Index] visits every element in turn. Each one can be read, changed, input, output or totalled.
Understanding Looping through an array with FOR (7c) in IGCSE Computer Science Paper 2
What it does: INPUT Names[Index] stores each entered value in the element at the current counter value, so all 30 elements are filled. Names[1] never changes, so it would output the first name 30 times. Names[Index] moves along the array. Index is only the position number. To total the marks you must add the element Marks[Index]. The loop must stop at the last element. Going up to 30 would try to use Scores[21] and beyond, which do not exist.
Common mistakes: A FOR loop sets its counter with the assignment arrow ←, not =. It should be FOR Index ← 1 TO 30. NEXT must name the loop counter that the FOR line uses. It should be NEXT Index, not the array name.
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 176–187) 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
FOR Index ← 1 TO 30Fill in the Blanks
Spot the Error
Student with a class code? Join your class →