Thinking in Code
Math · Foundational · Lesson 3 of 9

Repeat Yourself

Loops shrink programs

An interactive lesson with 7 steps, about 6 minutes: you predict, drag and solve, with instant feedback on every answer. It runs in your browser and needs JavaScript.

What you’ll learn

  • A loop runs its body a fixed number of times.
  • Nested loops multiply: 4 repeats of 5 repeats is 20.
  • Find the repeating pattern first, then wrap it in a loop.

Steps

  1. Loops
  2. A long corridor
  3. Climbing the stairs
  4. Counting moves
  5. Loops inside loops
  6. Around the block
  7. The long zigzag