REPEAT ... UNTIL loop (7a)
A post-condition loop: its statements run at least once, then the condition is tested after them. The loop stops when the condition is TRUE.
Understanding REPEAT ... UNTIL loop (7a) in IGCSE Computer Science Paper 2
What it does: The condition is TRUE straight away, but OUTPUT still runs once because the test comes after the body. REPEAT is a post-condition loop. The condition sits at UNTIL, which is at the end, so it is tested last. The loop should end when the correct password is typed, so use UNTIL Password = "secret".
Common mistakes: The loop needs to read a new value each time round. OUTPUT only displays Password, so the user is never asked and the condition keeps testing the same value. It should be INPUT Password. A REPEAT loop stops when the condition is TRUE. With <> the loop would stop on a wrong PIN and keep asking for the right one. It should be UNTIL PIN = 1234.
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 47–57) and word search (Modules 47–70).
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
REPEAT ... UNTILFill in the Blanks
Spot the Error
Student with a class code? Join your class →