User Guide
Table Of Contents
83
You can use arithmetic operator blocks as inputs to other
arithmetic blocks. For example, the expression 1 + ((14 / 3) x
3.14) can be created with three blocks:
Figure 5. Nested operator blocks
Creating and Using Variables
A variable is a named area of the computer’s memory in which
you can store pieces of data.
To create a variable in Scratch:
1. In the Blocks Palette, click Variables.
2. Click Make a Variable.
3. Type a name for your variable.
4. If you want all sprites to be able to access the
variable, click the circle next to For all sprites.
5. If you only want this sprite to be able to access the
variable, click the circle next to For this sprite only.
6. Click OK.
When you create a variable, Scratch adds a block for it in the
Variables section of the Blocks Palette. These orange variable
blocks will fit into blocks that accept a number. There are four
pick random ? to ? Picks a random number between the first number
and the second number.
? mod ? Performs modular arithmetic – the first number
“wraps around” if it reaches the value of the
second number.
round ? Rounds the specified number to the nearest
whole number.
? of ? Select from a range of additional math functions.
Block Description