World 3 · Loops · Guide 4 of 5Free guide
Loops and events together
Put a hat on top of a loop. One tap runs the whole loop, and then the hat is ready for your next one.
Meet the hat and the loop together
You know the hat block. You know the loop block. The hat waits for a tap. The loop runs what is inside it, again and again, as many times as its number says. Stack them, and one tap runs the whole loop. The moment the loop finishes, the hat goes back to waiting for your next tap.
So one tap says: bounce, bounce, bounce.
See it work
The ball's program is two blocks: a hat on top, and a loop with one bounce inside it. The loop's number is 3. Watch what two taps do.
The hat waited. The tap ran the loop, and the loop ran three bounces. Then the hat went back to waiting, and the next tap carried on from where the ball was standing. Two taps, six bounces, two blocks.
Your turn
Now you're the programmer.
Can you tap the ball into the net?
Press ▶, then tap the 🏀 until it reaches the 🥅.
Blocks
Your program
Go further
What if you take the hat off?
Pull the hat off your strip and press ▶. Your program runs once, right away, and it does not wait for you. Tap the ball now, and it tells you that nothing is listening. Put the hat back on, press ▶, and every tap is yours again.
For grown-ups
An event handler that runs a loop is the shape of every game controller — one press, and a whole run of steps repeats, which is how one button can do far more than one thing.
Keep going
Next in World 3Find the loop bug →Where this goes
Make a game other kids can play
The blocks on this page are a first taste. In a Kubrio project your kid builds a real game — powers, triggers, levels and all — and other kids get to play it.
