Converting between WHILE and REPEAT…UNTIL
Reverses WHILE X < 10. WHILE loops while TRUE, UNTIL stops when TRUE, so flip the condition. REPEAT also runs its body once before the first test.
Understanding Converting between WHILE and REPEAT…UNTIL in IGCSE Computer Science Paper 2
What it does: The opposite of <> is =, so WHILE Count <> 5 becomes UNTIL Count = 5 (the loop stops when Count equals 5). REPEAT tests its condition at the end, after the body has run. WHILE tests before the body, so it may never run. WHILE continues while its condition is TRUE, so the stopping condition of UNTIL must be reversed to become WHILE X < 10.
Common mistakes: This loop was converted from WHILE X < 10. REPEAT...UNTIL stops when its condition is TRUE, so the condition must be reversed to UNTIL X >= 10. Copying X < 10 unchanged would stop the loop at the wrong time. This loop was converted from UNTIL X >= 10. WHILE keeps looping while its condition is TRUE, so the condition must be reversed to WHILE X < 10 DO. As written, the loop would never run.
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 379–388) and word search (Modules 379–398).
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
UNTIL X >= 10Fill in the Blanks
Spot the Error
Student with a class code? Join your class →