← ACARA Digital Technologies Years 7–8

Scratch forever and repeat until blocks as while loops

The Python version of the Scratch forever block. It repeats its indented code nonstop until break. Scratch repeat until x becomes while not x:

Understanding Scratch forever and repeat until blocks as while loops in ACARA Digital Technologies Years 7–8

What it does: The while True loop repeats forever like the forever block. The if with break is how the loop is stopped. repeat until keeps looping while the condition is NOT yet true, so we put not in front of the condition. break leaves the loop completely. continue only skips to the next turn, so the loop keeps going. The loop should keep going until lives reach 0, so it runs while lives is NOT 0. Code inside a while loop must be indented. Without indentation it is not part of the loop.

Common mistakes: A double == compares values, so this line does not change score and the loop never reaches 5. Use a single = to assign: ' score = score + 1'. An if statement must end with a colon. The line should be " if answer == 'yes':".

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 482–519) and word search (Modules 420–519).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which Python line matches the Scratch forever block?
for True:while True:
Matches
while true: print("Go!")
↓
True needs a capital T in Python. Writing true gives a NameError because Python does not know that name. Use while True:
Applying
Meanings
Term
while True:
Meaning
The Python version of the Scratch forever block. It repeats its indented code nonstop until break. Scratch repeat until x becomes while not x:
Practice
score = 0
Testing
Gaps
True:
Check Answer
Spots
2while True:
3 score == score + 1

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

The 'Golden Phoenix' badge — Savannah Legend, 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 Python line matches the Scratch forever block?
A. while True: ✓
B. for True:
forever repeats nonstop, so Python uses while True: and the loop keeps running until something stops it.
2. Which Python line matches the Scratch block: repeat until score = 10?
A. while not score == 10: ✓
B. while score == 10:
repeat until keeps looping while the condition is NOT yet true, so we put not in front of the condition.
3. A while True: loop will stop by itself after a few turns.
A. True
B. False ✓
while True: never becomes False. It runs nonstop unless the code inside uses break.
4. How do you stop a while True: loop when the player types 'quit'?
A. if answer == 'quit': continue
B. if answer == 'quit': break ✓
break leaves the loop completely. continue only skips to the next turn, so the loop keeps going.
5. A Scratch repeat until block checks its condition. When does the loop run its code?
A. While the condition is still false ✓
B. While the condition is already true
repeat until stops once the condition becomes true, so it runs only while the condition is false.

Match the Pairs

while True: → The Python version of the Scratch forever block. It repeats the indented code nonstop until a break stops it.
while not done: → The Python version of Scratch repeat until done. It keeps looping while done is still False and stops once done becomes True.
A forever block that stops when the player presses q can be written with break inside a while True loop → while True: key = input() if key == "q": break
Scratch repeat until score = 10 becomes a while loop that uses not → while not score == 10: score = score + 1
while true: print("Go!") → True needs a capital T in Python. Writing true gives a NameError because Python does not know that name. Use while True:
while done: print("Working") → Scratch repeat until done means keep going until done is true, so the loop needs not. This loop would stop at the start while done is False. Use while not done:

Key Term

while True:
The Python version of the Scratch forever block. It repeats its indented code nonstop until break. Scratch repeat until x becomes while not x:

Fill in the Blanks

1. while True: print("Hello!")
Hint: Type the keyword that starts a Python loop. It is how the Scratch forever block begins.
2. while True: print("Go!")
Hint: Type the Boolean value that means the loop condition is never false, like a forever block.
3. done = False while not done: done = True
Hint: Type the keyword that flips the condition, so the loop runs until it becomes true, like repeat until.
4. while True: if score >= 10: break
Hint: Type the keyword that stops the loop right away, even though the loop is a forever loop.
5. lives = 3 while not lives == 0: lives = lives - 1
Hint: Type the comparison operator that checks whether two values are equal in the repeat until condition.

Spot the Error

Question 1
A score = 0
B while True:
C score == score + 1
D if score == 5:
E break
Line C — A double == compares values, so this line does not change score and the loop never reaches 5. Use a single = to assign: ' score = score + 1'.
Question 2
A while True:
B answer = input('Quit? ')
C if answer == 'yes'
D break
Line C — An if statement must end with a colon. The line should be " if answer == 'yes':".
Question 3
A lives = 3
B while True:
C lives = lives - 1
D if lives = 0:
E break
Line D — A single = assigns a value. To compare two values you need ==. The line should be ' if lives == 0:'.
Question 4
A energy = 3
B while True:
C energy = energy - 1
D print(energy
E if energy == 0:
F break
Line D — The print() call is missing its closing bracket. It should be ' print(energy)'.
Question 5
A tries = 0
B found = False
C while found:
D tries = tries + 1
E found = tries == 3
Line C — Scratch 'repeat until found' becomes 'while not found:'. With 'while found:' the loop never runs, because found starts as False.

Student with a class code? Join your class →