Loops & Conditions
A loop repeats an action many times without writing the same step again and again. A condition lets a program make a decision based on a yes-or-no question. Together, loops and conditions make programs smart.
Why Use Loops
Imagine drawing a square. Without a loop, you write "move forward, turn" four separate times. With a loop, you write "repeat 4 times: move forward, turn" just once. Loops save effort and reduce mistakes.
Types of Loops
- Repeat (number) times – Runs a fixed number of times
- Repeat Forever – Runs without stopping, until the program ends
- Repeat Until – Runs until a condition becomes true
Conditions — Making Decisions
A condition uses an "if" question to decide what happens next. If the answer is true, one set of steps runs. If false, a different set runs, or nothing happens.
Loops and Conditions in Scratch
Scratch has loop blocks like "repeat" and condition blocks like "if-then" in the Control category. You can place other blocks inside them to control what repeats or what happens under a condition.
🔑 Key Terms
- Loop – A set of steps that repeats automatically
- Condition – A yes/no question that decides what happens next
- If-Then – A block that runs steps only when a condition is true
✏️ Exercise
- What does a loop do?
- Which loop runs forever, until you stop the program?
- What does an "if-then" block check?
2. Repeat Forever
3. A condition (a true or false question)
© estudy247.com | Junior Computer Skills – Class 5
