Page 109 - 2502_Pakistan-kifayat_C-7
P. 109
4. Move Sprite while pressing the Down Arrow Key
This Scratch code makes the sprite turn 90 degrees and move 100 steps repeatedly 10 times when the
down arrow key is pressed.
OPERATORS BLOCK
Operators blocks in Scratch that perform mathematical operations, comparisons, and logic functions.
They are mainly used to manipulate numbers, compare values, and control the flow of the program with
conditions. They play a key role when combined with Control blocks and Conditional statements,
such as if, if-else, and repeat until.
Types of Operators Blocks in Scratch
Different types of Operator block are as follows:
Arithmetic Operators: These blocks perform basic mathematical calculations.
They are used inside conditions to compute or compare values before a decision
is made.
• Addition (+): Adds two numbers.
• Subtraction (-): Subtracts the second number from the first.
• Multiplication (×): Multiplies two numbers.
• Division (÷): Divides the first number by the second.
• Random (pick random): Picks a random number between two specified
values.
Comparison Operators: These blocks compare two values and return either true
or false.
• = (equal to): Checks if two values are equal.
• > (greater than): Checks if the first value is greater than the second.
• < (less than): Checks if the first value is less than the second.
Logical Operators: These blocks work with Boolean values (true/false). These
blocks are used to combine or reverse multiple conditions into a single logical
statement.
• and: Returns true if both conditions are true.
#More on Scratch 107

