REPEAT ... UNTIL as while True with break
Python's version of REPEAT ... UNTIL: the body runs at least once, then an if with break at the end stops the loop when the UNTIL condition is True.
Understanding REPEAT ... UNTIL as while True with break in IGCSE Computer Science Paper 2
What it does: The input line sits inside the loop before any test, so it runs once whatever happens. The if test comes last, like UNTIL. REPEAT stops when the UNTIL condition is True, so the if uses the same condition and break ends the loop. Do not reverse the condition. The if test must be indented inside the while True: body, at the end of it, so it is checked on every pass.
Common mistakes: An if statement must end with a colon. It should be 'if n > 0:'. A single = assigns a value. The UNTIL test compares two values, so it needs ==: 'if pw == 'cat':'.
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 216–231) and word search (Modules 188–231).
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
while True:Fill in the Blanks
Spot the Error
Student with a class code? Join your class →