2 of 1 ·Sequencing steps

Lesson 2 · Computational Thinking
Order matters — the make-a-sandwich algorithm.
Algorithms Everywhere
An algorithm is a clear list of steps. For a school bag: check tomorrow's timetable, choose the books, put them in. Try putting three familiar steps in order.
Click to zoomOrder is not a detailSocks, then shoes. Shoes, then socks.
Same two steps. Same words. One of them works and the other leaves you hopping around looking ridiculous.
In an algorithm, the order of the steps is part of the instruction. Change the order and you have changed what the algorithm does — often into something that fails completely.
Here is a real algorithm with its steps out of order. Watch it fail:
| Order given | Step | What happens |
|---|---|---|
| 1 | Pour the tea into a cup | Cup gets nothing — no tea made yet |
| 2 | Boil the water | Water boils, alone |
| 3 | Add tea leaves | Leaves go into the pot |
| 4 | Drink | You drink an empty cup |
Every step is correct on its own. The sequence is what's broken — and that is one of the most common bugs there is.
7 more parts in this lesson
Walkthroughs, code labs, mini-games and the checkpoint quiz unlock when you buy the course.