Welcome! Today we will learn how repeating steps in an algorithm makes coding easier.
An algorithm is a list of step-by-step instructions. We use algorithms in code to solve problems and draw shapes.

Iteration means repeating a set of steps using a loop. When we analyze code, we see that iteration saves time and reduces errors.
Imagine drawing an octagon. Without iteration, you need eight long lines of code. With a loop, you write just two lines and repeat them.
✏️ Worked example
Analyze the benefits of using iteration to draw an octagon instead of writing individual steps.
- 1. Identify the shape: An octagon has 8 equal sides.
- 2. Look at the code without iteration: You must write 8 move commands and 8 turn commands (16 total lines).
- 3. Look at the code with iteration: You write 1 loop command containing 1 move and 1 turn (3 total lines).
- 4. Compare the two methods: The loop uses much less code.
- 5. Conclude: Iteration makes the algorithm shorter, cleaner, and much easier to fix if you make a mistake.

Want the full interactive lesson — quiz, animations, and Finn cheering them on?