Robot In A Can
ENFR
Back

04 · The Power of Loops

Robot In A CanROBOT GAMES

Do more with fewer blocks.

The Power of Loops — pixel-art activity icon
A loop repeats a group of instructions. Compare a long square program with a shorter version that repeats. These two examples draw on screen.

Try it step by step

  1. Step 1 of 3

    A square without a loop

    The supplied square starter already has Repeat 4. For this first experiment, take Move and Turn out of the loop and make four copies in a row. Run it once: four sides, four quarter-turns.

  2. Step 2 of 3

    A square with a loop

    In this second copy, keep Move and Turn inside Repeat 4. Run it and compare the drawing with your long version. The same pattern needs fewer blocks!

  3. Step 3 of 3

    Triangle challenge

    Can you change the repeat count and turn angle to draw an equilateral triangle? The diagram shows the inside angle and the outside turn. Try finding the program yourself. The triangle has three sides. How many times should the instructions repeat?

    Triangle with a 60-degree inside angle and a 120-degree outside turn; no code solution

Explore next