Lesson 2 of 4 · 7 minutes

Instructions and programs

A program is a list of instructions. The computer does them in order, from top to bottom. This is the order of execution.

Think about getting dressed. Socks first, then shoes works. Shoes first, then socks does not. Same steps. Different order. Different result.

Steps that happen one after another form a sequence. Sometimes order does not matter. But often it does. Read a program top to bottom, one step at a time.

Socks before shoes works, while shoes before socks does not

Same steps. Different order. Different result.

Try it

Read these instructions from top to bottom:
First get a glass
Then pour the milk
Now drink it
What would go wrong if you poured the milk before getting a glass?

Quick check

A program's instructions run in what order?

Choose one answer.

Does the order of steps always change the result?

Choose one answer.

You can now read a program the way a computer does: in order, top to bottom.