Kubrio.
All concepts

World 3 · Loops · Guide 5 of 5Free guide

Find the loop bug

Every block is right. One of them is in the wrong place.

Meet inside and after

A loop has a space inside it. Every block in that space runs again and again, one time for each turn of the loop. A block that sits after the loop is outside it. It waits for the whole loop to finish, and then it runs one time. Same block, two places, two very different jobs.

the number — how many times
inside — this runs every time

This bug does not change a block. It changes where the block is standing.

See it work

First, a loop with no bugs in it. Two blocks sit inside, and the penguin does both of them on every turn.

ExampleA loop with no bugs

Step, climb. Step, climb. Step, climb. Both blocks were inside the loop, so both of them happened every time. Now meet a loop with one block left outside.

Your turn

Now you're the programmer.

Oh no — the penguin's program has a bug. Can you fix it?

Get the 🐧 to the 🐟. Pick up all three ⭐ on the way. One block is in the wrong place.

Your program

×3
1
1

Read the penguin's program. Where does it end up?

Blocks

Go further

What if you put the → after the loop instead?

Take the → off the strip. If the loop is open, tap the ✓ to close it. Now tap → — it lands after the loop instead of inside it. Press play. The penguin climbs three squares straight up the edge, then takes one step, and finishes in the fish's row with no stars at all. Same two blocks, same loop. Inside or after is the whole difference.

For grown-ups

When a loop does something once that should happen every time, a programmer's first question is whether the block is inside the loop or after it.

Keep going

Next: World 4 · Forever and togetherWhat does forever mean?
Every world← See all 30 concepts

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.

Ingenious projects that inspire kids to make things — until they find the thing only they could make.
Ages 6–13.
See the game projects or explore all the projects