Raspberry_Pi_Education_Manual

Notes:

Click on Sensing, select the block labelled “answer” and drag it onto the number ”0” in the previous block. Your script should look like the one in the screenshot above.

Now the program knows the first number in your sum. To tell it the second number, repeat the process above but remember to change “first_number” to “second_number” in the drop-down box of the variable block.

Now for the really clever bit

To do sums in Scratch, you need something called an “ operator ”. That’s just a fancy term for maths signs such as +, -, × and ÷. Yes, you guessed, we find these under the green Operators category in the Blocks Palette.

Click Operators: the “add” operator (“[ ] + [ ]”) is the first one on the list in the Blocks Palette.

We’re going to use the “add” operator, so drag it to the Scripts tab. We’ll use it to add the variables “first_number” and “second_number”.

From Variables, grab the variable “first_number” and drop it into the first blank space in the “add” operator. Drop “second_number” into the second blank space (see the screenshot on the next page).

A beginner’s guide to Scratch

26

Made with FlippingBook flipbook maker