Page 77 - iPrime_V2.2_class6
P. 77
This variable “Fruit“ is a string variable as we are saving names in the variable. If you save
numbers in a variable, say 10, it will be a numeric variable.
What if you could use Scratch to create a sports competition game? What
sports would be included, and how would players train and compete to become
champions?
OPERATORS
Operators Blocks are used to do arithmetic and logical calculations. Blocks in the Operators
category are oval and hexagon in shape. These blocks are colour-coded as light green.
Arithmetic Operators
Scratch has four operators that allow you to
do arithmetic calculations. These are addition,
Addition
subtraction, multiplication and division. Look at
the code to use addition block.
Similarly, you can use the other blocks to perform subtraction , multiplication and
division .
Relational Operators
Scratch has three operators that allow you to compare the relationship between two values or
variables. It will compare two numbers and
decide whether it is true or false. These are
greater than
greater than, less than and equals to.
Look at the code to use greater than block.
Similarly, you can use the other blocks to perform less than and equals to .
Logical Operators
Using logical operators, you can combine two or more relational operators to produce a single
true/false result. These blocks allow you to further refine your comparison of values.
The result is true only if the two expressions are true
The result is true only if either of the expressions is true
The result is true only if the expression is false
CONDITIONAL BLOCKS
Many times, you have to do a task which is dependent on some conditions. For example, you
have to make mango shake. There are two conditions:
a. Go to the refrigerator and check if there are mangoes. If mangoes are there, then you will
make mango shake.
75
Scratch Programming—Game Creation 75

