انتقل للمحتوى
Robo EgyptRobo Egypt
☰ Course contents
Robo Block: home
0. Lab tour1
1. Getting started5
2. Motion5
3. Looks and sound5
4. Events4
5. Loops5
6. Conditions and sensing4
7. Variables and randomness4
8. Project: the “Catch Robo” game3
9. Messages: characters talk to each other4
10. Clones: one character, many copies4
11. My Blocks: make a new block3
12. Operators and time4
13. The pro project: a jumping game4

Repeat forever

Section 5: LoopsLesson 5.3 · ⏱ 6 min

forever repeats the blocks inside it with no end, until you click the stop button. We use it in games because a game runs all the time.

Blocks: when 🚩 clicked, forever
🖥️ What happens on the stage?
Robo walks all the time, and every time he touches the edge of the stage he bounces back.
📌 Note
You can't snap a block under forever, because it never ends.

📌 Another example: the guard

Robo guards the road: he goes right, then comes back left, without stopping until you click 🛑.

Blocks: when 🚩 clicked, go to x: (-150) y: (0), forever
Going
Going
Coming back
Coming back
Still on guard
Still on guard
✍️ Practise
Add turn ↻ 5 inside forever with move and bounce, and watch how Robo moves.
✍️ Practise here in the lessonor open the lab in a new page ↗

🎯 Challenge yourself

Easy

Make Robo dance without stopping: he switches his costume every 0.3 seconds.

👀 Show the solution
Blocks: when 🚩 clicked, forever
The result on the stage
The result on the stage
Medium

Make Robo beat like a heart: he grows by 20, then shrinks by 20, without stopping.

👀 Show the solution
Blocks: when 🚩 clicked, set size to (100) %, forever
The result on the stage
The result on the stage
Hard

Robo walks at a slant (45) and bounces off the edges, with the pen down and its colour changing at every step.

👀 Show the solution
Blocks: when 🚩 clicked, erase all, go to x: (0) y: (0), point in direction (45), pen down, forever
Coloured lines that bounce
Coloured lines that bounce
Finished the lesson? Mark it so your progress counts.