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.

🔁 A Loop Repeats Steps
"Repeat 4 times: jump"

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.

🤔 If-Then Decision
If it is raining...
✅ True → Take umbrella
❌ False → Go without umbrella

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

  1. What does a loop do?
  2. Which loop runs forever, until you stop the program?
  3. What does an "if-then" block check?

© estudy247.com  |  Junior Computer Skills – Class 5

Leave a Comment

Your email address will not be published. Required fields are marked *