The same program, typed instead of dragged
The bus board prints one stop, then the next, then the last. A typed program does the same.
Loading lab…
Step 1 of 4
- Three lines, waiting to run, top to bottom.
- Line 1 runs.
Next stop: Canal Bridgeappears. - Line 2 runs.
Then: Temple Streetappears next. - Line 3 runs.
Last stop: School Gateappears last.
The rule
A typed program runs one line at a time, from the top. The lines run in the order you wrote them.
print("Next stop: Canal Bridge");
The machine is the computer that carries out your lines. One go through them is a run. A programming language is the words and rules the machine understands.
print is an instruction in that language. It writes out what is inside its round brackets. The quote marks say: write these characters as they are. The semicolon ; ends the line.
| The part | What it does |
|---|---|
print | The instruction's name |
( ) | Holds what it is given |
"..." | The characters to write out |
; | Marks the end of the line |
Swap two lines and the board prints them in the new order. No line runs before the one above it.