Idea 1of 23
Code is exact steps in order
How does a computer follow code?
Today you'll discover
- what a line of code tells a computer
- the order the lines run in
- how to find what code outputs
Think firstSET 4, ADD 3, MULTIPLY BY 2, OUTPUT
The computer runs these lines from the top down. What does it output?
Decide first, then press Next. Follow the arrow down the code, one line at a time.
Four blocks of code on the left: SET 4, ADD 3, MULTIPLY BY 2, OUTPUT. On the right a box named number and an output box. Step by step an arrow moves down the blocks and a table fills in: 4, then 4 to 7, then 7 to 14, then OUTPUT 14, which is ringed. The last step asks about SET 5, MULTIPLY BY 3, SUBTRACT 4.
See the whole ideathe big idea and the key word, in one place
The big idea
Code is exact steps that a computer runs one line at a time, top to bottom.
Reading a programSET 4 puts 4 in the box. ADD 3 makes it 7. MULTIPLY BY 2 makes it 14. OUTPUT shows 14.
Easy to get wrongA computer does not guess or skip. It does each line exactly as written, even when a line looks like a mistake.
Key words
- code
- instructions written so a computer can follow them exactly, one line at a time
- program
- a set of lines of code that does one job, run from the top down
Ready to use it?
- Read a short program and say what it outputs.