← Years 5–6 Creating Digital Solutions

The repeat until block

A loop block that keeps running the blocks inside it again and again, checking the condition each time, and stops only when the condition becomes true.

Understanding The repeat until block in Years 5–6 Creating Digital Solutions

What it does: The change block moves lives closer to 0 each time, so the condition will eventually be true and the loop will stop. 'Repeat until' keeps going while the condition is false and stops as soon as it becomes true. If nothing inside the loop changes the score, the condition stays false and you get an endless loop. 'Repeat until' is useful when you do not know how many repeats you need. 'Repeat 10' always runs exactly 10 times. The change must move the variable toward the goal. Use change count by 1 so count reaches 5.

Common mistakes: A plain repeat block needs a number of times, not a condition. To keep looping and check the condition each time, the line should be: repeat until <score = 3>. Changing steps by 0 means steps never gets closer to 5, so the condition never becomes true and the loop is endless. It should be: change steps by 1.

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 51–60) and word search (Modules 41–74).

Take this worksheet further — free with Cloodit

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

Learning
Duo
When does a 'repeat until' block stop running the blocks inside it?
When its condition becomes trueWhen its condition becomes false
Matches
set count to 0 repeat until <count = 5> move 10 steps
↓
Nothing inside the loop changes count, so count = 5 never becomes true and the loop never ends.
Applying
Meanings
Term
repeat until <condition>
Meaning
A loop block that keeps running the blocks inside it again and again, checking the condition each time, and stops only when the condition becomes true.
Practice
set score to 0
Testing
Gaps
<(steps) = 10>
Check Answer
Spots
1set score to 0
2repeat <score = 3>

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

The 'Nautilus' badge — Default Expert, 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. When does a 'repeat until' block stop running the blocks inside it?
A. When its condition becomes true ✓
B. When its condition becomes false
'Repeat until' keeps going while the condition is false and stops as soon as it becomes true.
2. Which block would keep a sprite walking until it touches the edge?
A. repeat until <touching edge?> (move 10 steps) ✓
B. repeat 10 (touching edge?)
The condition goes in the hexagon slot of 'repeat until', and the move block goes inside the loop.
3. When does the program check the condition in a 'repeat until' block?
A. Each time before the loop runs the blocks again ✓
B. Only once at the very start
The condition is checked every time round the loop, so the loop can stop at any time.
4. A game has 'repeat until <score = 10>' with nothing inside that changes the score. What will happen?
A. It stops straight away
B. It never stops, because the condition never becomes true ✓
If nothing inside the loop changes the score, the condition stays false and you get an endless loop.
5. Which loop will stop?
A. repeat until <score = 3> (say Hello for 1 seconds)
B. repeat until <score = 3> (change score by 1) ✓
Changing score by 1 each time moves it towards 3. Saying Hello never changes the score.

Match the Pairs

repeat until <score = 10> → Keeps running the blocks inside until the score becomes 10, then stops
repeat until <touching edge?> → Keeps repeating the blocks inside until the sprite touches the edge of the stage
To avoid an endless loop, something inside the loop must change so the condition can become true → repeat until <lives = 0> change lives by -1
The condition is checked each time before the blocks inside run again → repeat until <answer = 7> ask [What is 3 + 4?]
set count to 0 repeat until <count = 5> move 10 steps → Nothing inside the loop changes count, so count = 5 never becomes true and the loop never ends.
set count to 0 repeat until <count = 5> change count by -1 → Count goes down (0, -1, -2...) and moves away from 5, so the condition never becomes true.

Key Term

repeat until <condition>
A loop block that keeps running the blocks inside it again and again, checking the condition each time, and stops only when the condition becomes true.

Fill in the Blanks

1. repeat until <(steps) = 10> move (5) steps end
Hint: Type the name of the loop block that stops when its condition is true.
2. repeat until <(score) > 9> change [score] by 2 end
Hint: Type the comparison operator that checks if the score is bigger than 9.
3. repeat until <(lives) = 0> change [lives] by -1 end
Hint: Type the variable name that the loop changes so the condition can become true.
4. repeat until <(count) = 5> change [count] by 1 end
Hint: Type the block that updates the variable each time round, so the loop does not go on forever.
5. repeat until <(answer) = [yes]> ask [Ready?] and wait end
Hint: Type the reporter that holds what the user typed, which is checked every time the loop runs.

Spot the Error

Question 1
A set score to 0
B repeat <score = 3>
C change score by 1
D say score for 1 seconds
Line B — A plain repeat block needs a number of times, not a condition. To keep looping and check the condition each time, the line should be: repeat until <score = 3>.
Question 2
A set steps to 0
B repeat until <steps = 5>
C change steps by 0
D say I took 5 steps!
Line C — Changing steps by 0 means steps never gets closer to 5, so the condition never becomes true and the loop is endless. It should be: change steps by 1.
Question 3
A set lives to 3
B repeat until <lives > 0>
C change lives by -1
D say lives for 1 seconds
Line B — Lives starts at 3, so lives > 0 is already true and the loop would never run. The loop should stop when lives reaches 0: repeat until <lives = 0>.
Question 4
A repeat until <not touching edge?>
B move 5 steps
C end
D say I hit the edge!
Line A — The sprite is not touching the edge at the start, so this condition is true straight away and the loop stops before it moves. It should be: repeat until <touching edge?>.
Question 5
A set count to 0
B repeat until <count = 10>
C say count for 0.5 seconds
D set count to 0
E say Finished!
Line D — Setting count to 0 inside the loop resets it every time, so it never reaches 10 and the loop never ends. It should be: change count by 1.

Student with a class code? Join your class →