Repeating Actions
Repeating Actions
Iteration means repetition. Imagine writing "I will not be late" 100 times - boring! A loop does it for you. FOR loops repeat a set number of times (write it 100 times). WHILE loops repeat while a condition is true (keep writing until the teacher says stop). DO-WHILE always runs at least once before checking. Loops are the power tools of programming!
Now try it yourself
Quiz · Question 1 of 15
Which type of loop is best used when you know exactly how many times the loop should repeat?
Tap an answer to check it
This topic in real past papers
Every real exam question we've found on iteration (loops), with a full worked answer.
AQA Paper 1
Both sittings we have full papers for close the paper with the single biggest program-writing task, worth 8 marks in June 2022 (a bingo-ticket counting subroutine) and 11 marks in June 2023 (a full dice game simulation).
OCR Paper 2
All three sittings we have full papers for include a longer algorithm-writing question worth exactly 6 marks, always combining a loop with a running calculation: totalling and averaging a user-chosen quantity of numbers in June 2022, a three-round addition quiz in June 2023, and finding the highest-scoring team from sentinel-controlled input in June 2024.