← IGCSE Computer Science Paper 2

Flowchart for a REPEAT loop

In a flowchart, the loop body comes first, then a decision. NO goes back to the body, YES leaves the loop, so the body runs at least once.

Understanding Flowchart for a REPEAT loop in IGCSE Computer Science Paper 2

What it does: When Num > 0? is YES the UNTIL condition is TRUE, so the flow leaves the loop and carries on to OUTPUT Num. A WHILE loop continues on YES and exits on NO. A REPEAT loop exits on YES and continues on NO, so the directions are opposite. REPEAT ... UNTIL tests its condition at the end. The body is drawn first and the decision comes after it.

Common mistakes: A REPEAT loop draws the body first, so the flowchart must start with the Input box. Here a decision comes before the body, so the body might never run. Line 1 should be 'Input: Password'. In a REPEAT flowchart the NO path must return to the loop body. Here NO leaves the loop. It should be 'NO: back to Process'.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

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 188–213) 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.

Learning
Duo
In a flowchart for a REPEAT loop, where is the decision diamond placed?
After the loop bodyBefore the loop body
Matches
Flowchart: decision Age >= 18? drawn BEFORE the body INPUT Age, with YES going into the body
↓
The decision is drawn before the body, which makes a WHILE loop. In a REPEAT loop the body comes first and the decision comes after it.
Applying
Meanings
Term
REPEAT ... UNTIL
Meaning
In a flowchart, the loop body comes first, then a decision. NO goes back to the body, YES leaves the loop, so the body runs at least once.
Practice
REPEAT
Testing
Gaps
Number > 0
Check Answer
Spots
1Decision: Is Password empty?
2Decision: Password = Secret?

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Armadillo' badge — Shield Bearer, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. In a flowchart for a REPEAT loop, where is the decision diamond placed?
A. After the loop body ✓
B. Before the loop body
REPEAT ... UNTIL tests its condition at the end. The body is drawn first and the decision comes after it.
2. A REPEAT loop is drawn in a flowchart. How many times does the body run at least?
A. Once ✓
B. Zero times
The body comes before the decision, so it always runs once before the condition is checked.
3. In a REPEAT loop flowchart, which decision path goes back to the loop body?
A. The YES path
B. The NO path ✓
The loop repeats UNTIL the condition is TRUE. While the answer is NO (FALSE), the flow returns to the body.
4. In a REPEAT loop flowchart, which decision path leaves the loop?
A. The NO path
B. The YES path ✓
YES means the UNTIL condition is TRUE, so the loop ends and the flow continues to the next statement.
5. Which statement is true about the exit direction of a REPEAT loop compared with a WHILE loop?
A. REPEAT exits on YES, WHILE exits on NO ✓
B. REPEAT exits on NO, WHILE exits on YES
WHILE keeps looping while the condition is TRUE (YES), so it exits on NO. REPEAT keeps looping until the condition is TRUE, so it exits on YES.

Match the Pairs

REPEAT INPUT Guess UNTIL Guess = 7 → In the flowchart, the INPUT Guess process box comes first, then the decision Guess = 7? placed after it, so the body always runs at least once.
Guess = 7? NO -> back to INPUT Guess → The NO flow line goes back up to the start of the loop body, so the loop repeats while the UNTIL condition is not yet TRUE.
The YES path from the decision leaves the loop, because the UNTIL condition is now TRUE → REPEAT INPUT Num UNTIL Num > 0 OUTPUT Num
A REPEAT loop flowchart has the exit direction opposite to a WHILE loop: YES exits, NO loops back → REPEAT Count ← Count + 1 UNTIL Count = 10
Flowchart: decision Age >= 18? drawn BEFORE the body INPUT Age, with YES going into the body → The decision is drawn before the body, which makes a WHILE loop. In a REPEAT loop the body comes first and the decision comes after it.
Flowchart: after INPUT Pin, decision Pin = 1234? with YES going back to INPUT Pin and NO leaving the loop → The exit directions are the wrong way round. For REPEAT ... UNTIL, YES must leave the loop and NO must go back to the body.

Key Term

REPEAT ... UNTIL
In a flowchart, the loop body comes first, then a decision. NO goes back to the body, YES leaves the loop, so the body runs at least once.

Fill in the Blanks

1. REPEAT INPUT Number UNTIL Number > 0
Hint: Type the keyword that ends the loop and holds the exit condition, drawn as the decision after the body.
2. Number > 0? NO -> back to INPUT Number
Hint: Type the label on the decision path that returns to the loop body.
3. Number > 0? YES -> leave the loop
Hint: Type the label on the decision path that exits the REPEAT loop.
4. REPEAT INPUT Mark UNTIL Mark >= 0 AND Mark <= 100
Hint: Type the keyword that starts a loop whose body always runs once before the decision.
5. REPEAT loop exits when condition is TRUE
Hint: Type the Boolean value the condition must have for the flow to leave the loop.

Spot the Error

Question 1
A Decision: Is Password empty?
B Decision: Password = Secret?
C NO: back to Input
D YES: Output Welcome
Line A — A REPEAT loop draws the body first, so the flowchart must start with the Input box. Here a decision comes before the body, so the body might never run. Line 1 should be 'Input: Password'.
Question 2
A Process: Count <- Count + 1
B Output: Count
C Decision: Count = 5?
D NO: continue to END
E YES: leave the loop
Line D — In a REPEAT flowchart the NO path must return to the loop body. Here NO leaves the loop. It should be 'NO: back to Process'.
Question 3
A Terminator: END
B Input: Num
C Decision: Num > 0?
D NO: back to Input
E YES: go to END
Line A — A flowchart begins with a START terminator. Line 1 is labelled END, so the program would stop before it begins. It should be 'Terminator: START'.
Question 4
A Terminator: START
B Input: Guess
C Decision: Guess <> Answer?
D NO: back to Input
E YES: Terminator: END
Line C — With REPEAT ... UNTIL, the YES path leaves the loop when the condition is TRUE. The loop should stop when the guess is correct, so the decision must be 'Guess = Answer?', not '<>'.
Question 5
A Input: Num
B Process: Sum <- Sum + Num
C Process: Sum > 50?
D NO: back to Input
E YES: Output Sum
Line C — A question with YES and NO exits must be drawn in a decision diamond, not a process box. Line 3 should be 'Decision: Sum > 50?'.

Student with a class code? Join your class →