World 3 · Loops · Guide 2 of 5Free guide
How big can a loop be?
As big as its number says — so count the squares before you set it.
Meet the loop again
You already know the loop block. It holds a block inside it and runs that block again and again. The number on the loop says how many times. Tap the number and it counts up: 2, 3, 4, 5, 6, then back to 2. A loop does exactly what its number says — no more, no less.
So this one block says: hop, four times.
See it work
Here is the same trail twice. The kangaroo has one loop block both times. The only thing that changes is the number on it. Watch both.
The loop did exactly what its number said, both times. Three hops stopped one square short of the tree. Four hops landed on it. Count the squares first, then set the number.
Your turn
Now you're the programmer.
Can you hop the kangaroo to the tree?
Stop the 🦘 exactly on the 🌳.Solve it with 2 blocks → ⭐⭐⭐0 blocks
Blocks
Your program
Go further
What if two hops end up inside the loop?
It happens the moment you tap the hop block twice in a row. Now the loop does both hops every time, so the kangaroo goes twice as far. Try every number and watch: none of them stops on the tree, because the tree is five squares away and five will not split in two. Tap one of the hops to take it off, and the loop is yours again.
For grown-ups
A loop that runs one time too many, or one too few, is the most common mistake in programming — so common it has a name: the off-by-one error.
Keep going
Next in World 3Can a loop make a pattern? →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.
