← ACARA Digital Technologies Years 7–8

Visual repeat, forever and repeat-until blocks to JavaScript

Typed form of a repeat until score = 5 block: keep looping while the opposite is true. A repeat 10 block becomes a for loop, and forever becomes while (true).

Understanding Visual repeat, forever and repeat-until blocks to JavaScript in ACARA Digital Technologies Years 7–8

What it does: forever becomes while (true), which never ends by itself, and the if block from inside it becomes an if statement inside the braces. The variable score is set to 0 before the while loop starts, so the condition score !== 5 has a value to check and the loop can finish. while (score !== 5) keeps running while score is not 5, and stops as soon as score equals 5. That matches repeat until.

Common mistakes: The counter i goes down with i--, so it never reaches 10 and the loop never ends. A repeat 10 block becomes a for loop that counts up with i++. A forever block becomes while (true). With while (false) the condition is never true, so the loop body never runs.

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 599–610) and word search (Modules 583–613).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which JavaScript loop is the typed version of a 'repeat 10' block?
for (let i = 0; i < 10; i++) { }while (true) { }
Matches
while (score === 5) { score++; }
↓
The condition was copied directly from repeat until score = 5. A while loop needs the opposite condition, score !== 5, so this loop never runs when score starts at 0.
Applying
Meanings
Term
while (score !== 5)
Meaning
Typed form of a repeat until score = 5 block: keep looping while the opposite is true. A repeat 10 block becomes a for loop, and forever becomes while (true).
Practice
let score = 0;
Testing
Gaps
for (let i = 0; i < ; i++) {
Check Answer
Spots
3// repeat 10
4for (let i = 0; i < 10; i--) {

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

The 'Giraffe' badge — High Perspective, 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 JavaScript loop is the typed version of a 'repeat 10' block?
A. while (true) { }
B. for (let i = 0; i < 10; i++) { } ✓
A repeat 10 block runs a set number of times, so it becomes a for loop that counts to 10. while (true) is for forever blocks.
2. Which JavaScript is the typed version of a 'forever' block?
A. while (true) { } ✓
B. for (let i = 0; i < 1; i++) { }
A forever block never stops on its own, so the condition is always true: while (true).
3. A 'repeat until score = 5' block becomes which loop?
A. while (score !== 5) { } ✓
B. while (score === 5) { }
Repeat until keeps going while the stop condition is NOT true yet. So you loop while score !== 5.
4. True or false: 'repeat until score = 5' and 'while (score !== 5)' mean the same thing.
A. False: while (score !== 5) stops when score is not 5
B. True: both stop once score is 5 ✓
while (score !== 5) keeps running while score is not 5, and stops as soon as score equals 5. That matches repeat until.
5. Where should the counter variable go for a while loop that counts?
A. let score = 0; before the while loop ✓
B. let score = 0; inside the while loop body
Set the counter before the loop. If you set it inside, it resets to 0 on every pass and the loop may never finish.

Match the Pairs

for (let i = 0; i < 10; i++) { → The typed version of a repeat 10 block: the loop body runs 10 times.
while (score !== 5) { → The typed version of a repeat until score = 5 block: keep looping while score is NOT 5.
A forever block with an if block inside becomes an endless while loop with an if statement in its body. → while (true) { if (touching) { console.log("Hit!"); } }
A counter variable must be created before the loop so the loop condition can use it. → let score = 0; while (score !== 5) { score++; }
while (score === 5) { score++; } → The condition was copied directly from repeat until score = 5. A while loop needs the opposite condition, score !== 5, so this loop never runs when score starts at 0.
for (let i = 0; i < 10; i++) { console.log(i); } console.log(count); → A forever block was typed as for with no loop that never ends; instead, the counter is used without being created. The variable count was never declared before it is used, so this causes a ReferenceError.

Key Term

while (score !== 5)
Typed form of a repeat until score = 5 block: keep looping while the opposite is true. A repeat 10 block becomes a for loop, and forever becomes while (true).

Fill in the Blanks

1. for (let i = 0; i < 10; i++) { console.log("Hello"); }
Hint: Type the number of repeats from the repeat block that the loop condition counts up to.
2. while (true) { if (score > 5) { console.log("Win"); } }
Hint: Type the boolean value that keeps a forever block running with no end.
3. let score = 0; while (score !== 5) { score++; }
Hint: Type the comparison operator meaning 'not equal to', the opposite of the repeat until score = 5 condition.
4. let score = 0; while (score !== 5) { score++; }
Hint: Type the keyword that creates the counter variable, which is set before the loop and changes inside it.
5. for (let i = 0; i < 10; i++) { console.log("Jump!"); }
Hint: Type the keyword that a repeat 10 block becomes when it is written as typed code.

Spot the Error

Question 1
A let jumps = 0;
B console.log('Start');
C // repeat 10
D for (let i = 0; i < 10; i--) {
E jumps++;
F }
Line D — The counter i goes down with i--, so it never reaches 10 and the loop never ends. A repeat 10 block becomes a for loop that counts up with i++.
Question 2
A let timer = 0;
B while (false) {
C timer++;
D if (timer === 5) break;
E }
Line B — A forever block becomes while (true). With while (false) the condition is never true, so the loop body never runs.
Question 3
A let score = 0;
B // repeat until score = 5
C while (score === 5) {
D score++;
E }
Line C — Repeat until score = 5 means keep looping while score is NOT 5. Using === 5 makes the loop stop straight away because score starts at 0. It should be while (score !== 5).
Question 4
A let score = 0;
B while (score = 5) {
C score += 1;
D console.log(score);
E }
Line B — A single = assigns 5 to score instead of comparing, so the condition is always truthy and the loop never ends. A repeat until block needs while (score !== 5).
Question 5
A // repeat until count = 10
B let count = 10;
C while (count !== 10) {
D count++;
E }
Line B — The counter variable must be set to its starting value before the loop. Starting at 10 means count !== 10 is false at once, so the loop never runs. It should be let count = 0;

Student with a class code? Join your class →