← Years 5–6 Creating Digital Solutions

REPEAT UNTIL a condition is true

A loop that keeps repeating its steps until a condition becomes true. Use it when you don't know how many times. Make sure the condition can happen, or the loop never stops.

Understanding REPEAT UNTIL a condition is true in Years 5–6 Creating Digital Solutions

What it does: You can't know how many rolls it will take to get a 6, so the loop runs until the condition is true. The condition comes after UNTIL. 'Walk forward' is the step that gets repeated.

Common mistakes: The loop would stop on a wrong answer. It should keep asking until the answer is correct, so the line should be UNTIL answer is correct. The score starts at 0 and goes up, so it can never be less than 0. The loop would never stop. It should be UNTIL score = 10.

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 11–20) and word search (Modules 1–20).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which loop stops when the condition becomes TRUE?
REPEAT ... UNTILREPEAT 5 TIMES
Matches
REPEAT Walk 1 step UNTIL I have wings
↓
The condition can never become true, because walking will never give you wings. The loop never stops.
Applying
Meanings
Term
REPEAT ... UNTIL
Meaning
A loop that keeps repeating its steps until a condition becomes true. Use it when you don't know how many times. Make sure the condition can happen, or the loop never stops.
Practice
REPEAT
Testing
Gaps
Check Answer
Spots
3 READ the answer
4UNTIL answer is wrong

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

The 'Fennec Fox' badge — Listener, 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. Which loop stops when the condition becomes TRUE?
A. REPEAT 5 TIMES
B. REPEAT ... UNTIL ✓
REPEAT ... UNTIL keeps going until its condition is true. REPEAT 5 TIMES stops after a set count instead.
2. You are filling a bucket and don't know how many scoops it will take. Which loop fits best?
A. REPEAT add a scoop UNTIL bucket is full ✓
B. REPEAT 10 TIMES add a scoop
When you don't know how many times, use REPEAT UNTIL with a condition like 'bucket is full'. A fixed count of 10 might overflow or stop too early.
3. What is the stopping condition in this loop? REPEAT walk forward UNTIL you reach the wall
A. walk forward
B. you reach the wall ✓
The condition comes after UNTIL. 'Walk forward' is the step that gets repeated.
4. REPEAT knock on door UNTIL someone answers. When does the knocking stop?
A. When someone answers ✓
B. After knocking 3 times
The loop stops as soon as the condition 'someone answers' is true. There is no set count of knocks.
5. Which loop will never stop? Both start with the counter at 1 and the step is 'say hello'.
A. REPEAT say hello UNTIL 1 is equal to 2 ✓
B. REPEAT say hello UNTIL 1 is equal to 1
1 can never equal 2, so the condition never becomes true and the loop goes on forever. A loop's condition must be able to happen.

Match the Pairs

REPEAT Add 1 cup of water UNTIL bucket is full → Keep adding water again and again until the bucket is full, even if we don't know how many cups it takes
UNTIL password is correct → The stopping condition: the loop ends when this becomes true
Use REPEAT UNTIL when you don't know in advance how many times the steps must run → REPEAT Roll the dice UNTIL the dice shows 6
A loop must change something inside it so the stopping condition can become true → REPEAT Eat one bite UNTIL plate is empty
REPEAT Walk 1 step UNTIL I have wings → The condition can never become true, because walking will never give you wings. The loop never stops.
REPEAT Clap your hands UNTIL → The stopping condition is missing after UNTIL, so the computer doesn't know when to stop repeating.

Key Term

REPEAT ... UNTIL
A loop that keeps repeating its steps until a condition becomes true. Use it when you don't know how many times. Make sure the condition can happen, or the loop never stops.

Fill in the Blanks

1. REPEAT Kick the ball UNTIL the goal is scored
Hint: Type the keyword that starts the loop and marks where the repeated steps begin.
2. REPEAT Stir the soup UNTIL the soup is hot
Hint: Type the keyword that introduces the stopping condition at the end of the loop.
3. REPEAT Add 1 to steps UNTIL steps = 10
Hint: Type the operator that checks whether the number of steps equals the target.
4. REPEAT Add 1 to score UNTIL score = 10
Hint: Type the variable that changes inside the loop and is also checked in the stopping condition.
5. REPEAT Add 1 to count UNTIL count = 3
Hint: Type the action word that changes the count, so the condition can become true and the loop stops.

Spot the Error

Question 1
A REPEAT
B ASK for the password
C READ the answer
D UNTIL answer is wrong
Line D — The loop would stop on a wrong answer. It should keep asking until the answer is correct, so the line should be UNTIL answer is correct.
Question 2
A SET score TO 0
B REPEAT
C ADD 1 TO score
D UNTIL score < 0
Line D — The score starts at 0 and goes up, so it can never be less than 0. The loop would never stop. It should be UNTIL score = 10.
Question 3
A REPEAT
B Throw the dice
C IF you roll a 6
Line C — A REPEAT loop must end with UNTIL and the stopping condition. IF belongs to branching. It should be UNTIL you roll a 6.
Question 4
A UNTIL
B Stir the soup
C Taste the soup
D UNTIL it tastes good
Line A — A REPEAT ... UNTIL loop must start with REPEAT. UNTIL goes at the end with the condition. Line 1 should be REPEAT.
Question 5
A SET energy TO -3
B REPEAT
C Run one lap
D SUBTRACT 1 FROM energy
E UNTIL energy = 0
Line A — Energy starts below 0 and keeps going down, so it never equals 0. The loop would never stop. It should start at a positive number such as SET energy TO 10.

Student with a class code? Join your class →