BOB3 is going to reveal the truth!
We’re going to programme BOB3 to recognise true and false by giving a him a question:
If it’s true, the lights should light green, otherwise they should be red.
To programme this, we use:
if - else
- either all the commands in the
- or all the commands in the
A block is all the commands in curly brackets/braces
BOB decides which block to run by checking to see if the condition in line 12 is true or false:
if (1 == 1)
== mens "exact equal"
1 == 1 is true
1 == 3 is false, because a one is not a three!
1 == 3
What happens now?
8 == 8
What do you expect will happen?