Page 109 - 2502_Pakistan-kifayat_C-6
P. 109
Loop
Loops are blocks that repeat a set of instructions multiple times, helping you do something again and
again without writing the same code repeatedly.
Common loop blocks in Scratch are:
block repeats a set of blocks for a given number of times.
block keeps on repeating a set of blocks till the stop button is clicked.
block repeats a set of actions until a specified condition is true. Once the condition
becomes true, the loop stops.
Conditional Statement
Conditional Statements let your program make decisions by checking if something is true or false,
then running different blocks based on that.
The main blocks are:
block check if a condition is true, and only then it runs the blocks inside it.
block is used when you want the program to choose between two different actions
depending on whether a condition is true or false.
Variable
Variables are used to store information that can change while your program runs. Think of a variable
like a container or box that holds a value, such as a number or text.
You can:
Create variables (like score, lives, or timer).
Set their value (for example, start score at 0).
Change their value (increase score when you collect a coin).
Use their value to control what happens in your script (like ending the game when lives reach 0).
Factbot
Every time you type a name or number, the previous value in the variable gets deleted and the new value is stored.
#Fundamentals of Programming Constructs 107

