Skip to main content
โ† Back to Traditional Coding samples
โŒจ๏ธTraditional Codingยท10 minยทSample Lesson

First, Then, Last: Putting Steps in Order Like a Coder

If you brush your teeth before you put toothpaste on the brush, nothing gets clean! The order of steps matters. In coding, a list of steps in the right order is called a sequence, and it is one of the very first things every coder learns. A robot or computer will do EXACTLY what you tell it, in the EXACT order you tell it, even if the order is silly.

What You'll Learn

- What a sequence is in coding - Why order changes the result - How to write step-by-step directions for a robot or a friend - How to find and fix a step that is out of order

Why Order Changes Everything

Making a peanut butter sandwich has a sequence: 1) Get out bread. 2) Spread peanut butter. 3) Put the slices together. If you swap steps 2 and 3, you would spread peanut butter on a sandwich that is already closed, which makes a mess, not a sandwich. Coders write sequences for computer games too. In a game, 'jump' has to come before 'land,' or the character would land before it even jumped, which does not make sense to the computer.

Reading a Sequence Like a Robot

Pretend you are a robot that only understands: turn left, turn right, move forward one step. To get from your desk to the door, someone has to write the exact sequence, like 'move forward, move forward, turn right, move forward.' If they forget a step, the robot bumps into a wall, because robots cannot guess what you meant.

Say It Out Loud First

Before writing a sequence, say every step out loud in order. If it sounds weird out loud, like putting on shoes before socks, it will be wrong in code too.

Put these getting-ready-for-bed steps in the right order (match each to its step number).

Terms

Step 1
Step 2
Step 3
Step 4

Definitions

Brush teeth
Put on pajamas
Read a book
Turn off the light

Drag terms onto their definitions, or click a term then click a definition to match.

โ“

A sequence says: 1) Pour cereal, 2) Pour milk, 3) Get a bowl. What is wrong with this sequence?

โ“

Why does a computer follow the wrong order even if it makes a silly result?

๐ŸŽฏ

Write a Robot Sequence

1) Pick a simple task, like making a bed. 2) Write it as a numbered sequence of at least 5 steps, using only actions a robot could do (no guessing words like 'somehow'). 3) Read your sequence to a family member and have them act it out exactly as written, doing nothing you did not say. 4) Fix any step where they got stuck or did the wrong thing. Deliverable: your corrected numbered sequence of at least 5 steps.

Flashcards โ€” click each card to reveal the answer

Want to keep learning?

Sign up for free to access the full curriculum โ€” all subjects, all ages.

Start Learning Free