Loops and choices
Try itDoing it again
A loop can also stop when something changes. This slime keeps jumping until the hero comes near.
How to read it
In the last chapter, an if asked a question once. This loop asks a question every time it goes round: is the hero near?
| The answer | What the slime does |
|---|---|
| No | Goes round again: jump, wait. |
| Yes | Leaves the loop, and carries on with the step after end. |
Near means within 3 blocks.
Try it
- Press Play
. The slime jumps and jumps. The hero is too far away. - Click the little game, so the arrow keys work.
- Hold the right arrow key to walk the hero toward the slime.
- Stop when the slime says "Oh! Hello."
The jumping has stopped for good. The loop is over, and the script has run out of steps.
This section ticks itself when you press Play.

