LESSON 1 · 5 MIN
Algorithms: step-by-step instructions
Before writing code, programmers plan the exact steps.
An algorithm is a list of steps that solves a problem. A recipe is an algorithm; so are the directions to a friend's house.
Computers follow steps exactly as written. If a step is missing or in the wrong order, the result goes wrong — that's called a bug.
Programmers often write steps in plain words first (called pseudocode) before turning them into code.
Key idea
Code is just an algorithm written in a language the computer understands.
Try it
Write the steps for brushing your teeth. Did you forget to put toothpaste on the brush?