If… then
Section 6: Conditions and sensingLesson 6.1 · ⏱ 7 min
The if block asks a question. If the answer is “yes” it runs the blocks inside it, and if it is “no” it skips them. The question goes in the hexagon shape, and comes from the Sensing blocks (light blue).

🖥️ What happens on the stage?
Robo walks, and when he touches the edge he says Ouch! and turns to come back.
📌 Note
We put if inside forever so it asks the question all the time, not just once.
📌 Another example: Robo grows at every edge
Inside forever we ask at every step: is Robo touching the edge? If yes, he turns back and grows by 15.



✍️ Practise
Make Robo switch his costume every time he touches the edge.
✍️ Practise here in the lesson✖ Close the labor open the lab in a new page ↗
🎯 Challenge yourself
Easy
Every time Robo touches the edge he goes back to the middle and says “Again! 🔁”.
👀 Show the solution🙈 Hide the solution


Medium
Use if … else: Robo says “Right ➡️” if x is greater than 0, else he says “⬅️ Left”. Make him glide from left to right.
👀 Show the solution🙈 Hide the solution



Hard
“You can't catch me” game: if the mouse touches Robo, he jumps to a random place.
👀 Show the solution🙈 Hide the solution



