← Years 5–6 Creating Digital Solutions

The forever block

A block that repeats the blocks inside it again and again until the program is stopped, for example with stop all. You can put an if block inside it to keep checking something.

Understanding The forever block in Years 5–6 Creating Digital Solutions

What it does: Putting an if block inside forever means the check is repeated again and again, so the sprite notices the edge whenever it happens. When the if condition becomes true, the stop all block runs and ends the program, which also ends the forever loop. Repeat until checks a condition to finish. Forever has no condition, so it keeps looping.

Common mistakes: An if block needs the word 'then' so the program knows what to do when the check is true. It should be: if touching edge? then. Inside a forever block we check things with an if block, not a 'when' block. The line should be: if touching Ball? then.

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
What does the forever block do with the blocks inside it?
It runs them one time and then finishesIt repeats them again and again until the program is stopped
Matches
if touching edge then forever say Ouch!
↓
The forever block is inside the if block, so the check only happens once. If the sprite is not touching the edge at that moment, nothing repeats. The if block should go inside forever.
Applying
Meanings
Term
forever
Meaning
A block that repeats the blocks inside it again and again until the program is stopped, for example with stop all. You can put an if block inside it to keep checking something.
Practice
when green flag clicked
Testing
Gaps
Check Answer
Spots
2forever
3 if touching edge?

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

The 'Bear' badge — Forest Guardian, 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. What does the forever block do with the blocks inside it?
A. It repeats them again and again until the program is stopped ✓
B. It runs them one time and then finishes
The forever block keeps looping the blocks inside it. It does not stop by itself.
2. Which block is the best choice if a game needs to keep checking whether the player touches a wall?
A. A single if block on its own
B. forever with an if block inside ✓
A single if only checks once. Putting if inside forever means the check happens over and over.
3. Which block can end a program that is stuck in a forever loop?
A. stop all ✓
B. say Hello!
The stop all block ends every script, including a forever loop.
4. True or false: A forever block counts how many times it repeats and stops at 10.
A. False. It keeps going until the program is stopped ✓
B. True. It stops after 10 repeats
A repeat 10 block stops after 10 times. A forever block has no number and never ends on its own.
5. Which script keeps moving a sprite across the stage until you press stop?
A. move 10 steps
B. forever: move 10 steps ✓
Without forever, the sprite moves only once. Forever makes the move happen again and again.

Match the Pairs

forever → A block that repeats the blocks inside it again and again until the program is stopped
stop all → A block that stops the whole program, even a forever loop that would otherwise keep going
Keep checking whether the player has touched the edge, over and over, while the program runs → forever if touching edge then say Ouch!
End a forever loop when the game is over by stopping the whole program → forever if score = 10 then stop all
if touching edge then forever say Ouch! → The forever block is inside the if block, so the check only happens once. If the sprite is not touching the edge at that moment, nothing repeats. The if block should go inside forever.
forever move 10 steps stop all → The stop all block is placed after forever, so it never runs because forever never finishes. Put stop all inside an if block inside the forever loop.

Key Term

forever
A block that repeats the blocks inside it again and again until the program is stopped, for example with stop all. You can put an if block inside it to keep checking something.

Fill in the Blanks

1. when green flag clicked forever move 10 steps
Hint: Type the block name that repeats the blocks inside it again and again.
2. forever if touching edge then turn 15 degrees
Hint: Type the keyword for the block that checks something each time round the forever block.
3. forever if lives = 0 then stop all
Hint: Type the block that ends the whole program and so stops the forever block.
4. forever if touching Cat then say Ouch!
Hint: Type the word that comes after the condition and leads to the blocks that run when it is true.
5. forever if score > 9 then stop all
Hint: Type the comparison symbol that checks if the score is bigger than 9.

Spot the Error

Question 1
A when green flag clicked
B forever
C if touching edge?
D stop all
E end
F end
Line C — An if block needs the word 'then' so the program knows what to do when the check is true. It should be: if touching edge? then
Question 2
A when green flag clicked
B forever
C when touching Ball? then
D say Goal! for 1 seconds
E end
F end
Line C — Inside a forever block we check things with an if block, not a 'when' block. The line should be: if touching Ball? then
Question 3
A when green flag clicked
B forever 10
C turn 5 degrees
D end
Line B — The forever block does not have a number. It repeats until the program is stopped. The line should just be: forever
Question 4
A when green flag clicked
B forever
C if score + 10 then
D stop all
E end
F end
Line C — The + block adds numbers. It does not check anything. To see if the score is 10, use the = block: if score = 10 then
Question 5
A when green flag clicked
B forever
C if touching edge? then
D wait 1 seconds
E end
F end
Line D — Waiting does not end the program, so the forever block would keep going. To end the program, use: stop all

Student with a class code? Join your class →