Page 42 - Ones and Zeros 4 (Student Book)
P. 42
If Statement
‘if statement’ ‘Looks’ menu
‘control’ block ‘operator’ block
duplicate
Let’s Learn
Any signal that goes into the computer, by clicking, typing, or speaking, is called input.
When the computer plays a sound or displays something on the screen, we call that output.
Programmes use a script called an ‘if statement’ which is a question followed by two
outputs. Depending on our answer, the ‘if statement’ will choose which output to show.
Let’s Practise
Using the ‘Looks’ menu.
1 Open Scratch by double-clicking on the
‘Scratch’ shortcut.
2 Load the project, ‘A Wizard’s Quiz.sb3’.
3 From the ‘Looks’ menu, choose that after
the player types his name, the wizard will
say hello for 2 seconds.
4 He will then say his name.
5 A way of making him look like he’s
moving is to change his costume.
There’s a block called ‘switch
costume to’. Select this block
and choose ‘wizard-b’.
6 Now it’s time to add instructions. 3
Use another ‘say’ block to explain 4
the game.
5
7 You can switch his costume again
to make it look like he’s moving. 6
7
8 Add more information with another
‘say’ block. 8
9 The last ‘say’ block will finish our 9
script. It will instruct the player to
start if he presses the space bar.
40