AQA · GCSE · Computer Science
Course version: 8525 · Version from Sept 2020
Programming concepts: FOR i ← 1 TO 5 … Instructions here … ENDFOR
This pseudocode shows a definite (count-controlled) FOR loop.
Checked against the AQA 8525 specification (opens in a new tab) on .
- Point 11 of 23
Study notes
From the checked teaching notes for this specification point.
The idea
This pseudocode shows a definite (count-controlled) FOR loop. The loop variable i is set to 1 at the start, and the body between FOR and ENDFOR runs once for each value from 1 to 5 inclusive, so the instructions execute five times. On each pass i takes the values 1, 2, 3, 4 and 5 in turn, and after the final pass the loop ends. The arrow ← means assignment, so i is assigned the starting value. Because the number of repetitions is fixed by the range 1 TO 5, this is definite iteration rather than a condition-controlled loop. A learner answering a multiple-choice question about this code should count the values in the range, identify the loop variable, and recognise that the body repeats a known number of times.
What earns the marks
- The construct is a definite (count-controlled) FOR loop because the start and end values are fixed.
- The loop variable i is assigned the value 1 at the start of the loop.
- The body executes five times, once for each of the values 1, 2, 3, 4 and 5.
- The loop ends after the pass in which i equals 5, because the range is inclusive.
- The arrow ← denotes assignment of the starting value to the loop variable.
Common mistakes and how to put them right
Saying the body runs four times by subtracting the start from the end.
Put it right by counting 1, 2, 3, 4, 5.
Describing the loop as condition-controlled.
Put it right by calling it definite (count-controlled) iteration.
Believing i stays at 1 throughout.
Put it right by listing its value at each iteration.
Reading ← as 'equals' in a comparison sense.
Put it right by describing it as assigning the start value.
Exam tips
- Count the values in the range explicitly to confirm the number of executions.
- Identify the loop variable and its start and end values before answering.
- Check whether the range is inclusive when deciding how many times the body runs.
Try the lesson
The start of the Programming concepts: FOR i ← 1 TO 5 … Instructions here … ENDFOR lesson, made from checked teaching notes for this specification point.
Have a go first
A count-controlled loop is written as FOR i ← 1 TO 5. How many times do the instructions inside the loop run?
There is more to this lesson
The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge
Test your understanding of Programming concepts: FOR i ← 1 TO 5 … Instructions here … ENDFOR
Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge