Page 85 - TP-Play_V-2.0_Book-5
P. 85
This data is stored in variables. It is called variable because it does not have a fixed
value, its value changes. For example, in the move block, the variable has a value
10 by default. You can modify this value according to your script.
Types of Variables
Variables can store numbers as well as letters. A variable that stores numbers is
called a numeric variable. These numbers are used in calculations. Examples are 48,
-986, 12345, etc.
A variable that stores letters in the form of strings or characters is called string
variable. A string variable can store names, words, sentences, numbers, and
enclosed in quotation marks. For example, “Kavita”, “I am 12 years old”, “12345”.
These variables are not used in calculations.
Creating Variables in Scratch
To create variables in Scratch, follow the given steps:
Step 1 Click on Variables block category. A set of blocks appears in the block
palette.
Step 2 Click on Make a Variable block. A New Variable dialog box appears. Type
a variable name in the New variable name box.
Step 3 Click on the radio button of either of the options. Click on For all sprites if
you want this variable to appear for all the sprites.
Or
Click on For this sprite only if you want this variable to appear for this
sprite only. Here we have added the variable fruit. It will be available for all
the sprites.
Step 4 Click Ok button.
2
1 3
4
Creating a Game in Scratch 85

