Sequencing
An algorithm is a plan which helps the computer programmer to write their program.
The algorithm must put the events in the program in the correct order.
Placing code in the correct order is known as sequencing.
Tell a joke!
Using just 2 sprites and speech bubbles, code your sprites to tell a simple joke.
Each sprite must talk in turn and must have two lines to say.
See the example on the right.
The joke must play perfectly in sequence - no gaps - no overlaps!
Computer programs always work or run in a fixed order or sequence, even if this does not make sense. So it is vital to get your program scripts into the correct sequence.
The joke above was programmed in Scratch. To make the joke work you must carefully plan the sequence of instructions.
If one character is talking for 2 seconds, the other character must wait for 2 seconds.
If a character is talking for 1 second, the other character must wait for 1 second and so on.
See the scripts for each of the blue and the purple characters below.
if the program is not correctly sequenced, then we say there is a bug in the code. This is a logic bug because there is an error in the logical sequence. When the bug is correct we say the code has been debugged.
Q5. Explain what a computer programmer means by the term sequencing.
Q6. What do you do when you debug computer code?