Ibnovate Scratch Creators
⏱ 60 minLive session · ages 7–11

Session 5 — If–Then Decisions

Duration: 60 min · Format: live online · Ages: 7–11

Session goal: by the end, students can drop a Sensing block into an if <> then block to ask a yes/no question, and build a sprite that makes a decision — if it's touching the edge it bounces, otherwise it keeps moving.

Before class — prep (5 min)

Agenda

Time Segment
0:00 Hook — "only if…" games (5 min)
0:05 Teach — the if–then block & Sensing questions (13 min)
0:18 Teach — if–then–else: two paths (12 min)
0:30 Activity — build a sprite that reacts (22 min)
0:52 Check for understanding (5 min)
0:57 Wrap-up + homework (3 min)

0:00 · Hook (5 min)

Play "only if…" for one minute. Give the class a rule and have them act it out:

Notice out loud: some kids did the action, some didn't — it depended on whether the rule was true for them. Then reveal: "Today we teach our sprite to do that same thing — do something only if a question is true. In code we call it an if–then decision."


0:05 · Teach — The if–then block & Sensing questions (13 min)

Share this diagram and read it left to right:

An if-then decision: if the sprite is touching the edge then it bounces, otherwise it keeps moving

Explain, slowly, pointing on your shared screen:

Meet three Sensing questions — each one is a diamond block that answers yes or no:

Build this together live on your shared screen:

1. From Control (orange), drag out if <> then.

2. From Sensing (cyan), drag touching [edge]? and drop it into the diamond hole. Watch it snap into the < > shape.

3. From Looks (purple), snap say [Ouch!] for 1 seconds inside the mouth.

Now your script reads:

if <touching [edge]?> then
  say "Ouch!" for 1 seconds

Drag the sprite so it touches the edge, run it, and it says "Ouch!" Drag it to the middle, run again — nothing happens, because the answer is now no.

⚠ Watch for the empty diamond: an if <> then with nothing in the diamond can never be true, so the inside blocks never run. Always fill the < > with a Sensing (or Operators) question first.

Ask: "Which colour block gives us the question? Which block does the action?" (Question = Sensing/cyan; action = whatever we snap inside, here Looks/purple.)


0:18 · Teach — if–then–else: two paths (12 min)

Explain: sometimes we want one thing if yes, and a different thing if no. That's the if <> then … else block — also in Control (orange). It has two mouths: the top runs when the answer is yes, the bottom (else) runs when the answer is no.

Build this together:

1. Start a fresh script with when green flag clicked (Events, yellow).

2. Add a forever loop (Control, orange) so the sprite keeps checking — we met forever in Session 4.

3. Inside forever, add move 10 steps (Motion, blue).

4. Under it, add if <> then … else. Drop touching [edge]? into the diamond.

5. In the top mouth (yes): turn ↻ 180 degrees — spin around.

6. In the else mouth (no): leave it empty for now, or add say [zooming!].

Now your script reads:

when green flag clicked
forever
  move 10 steps
  if <touching [edge]?> then
    turn cw 180 degrees
  else
    say "zooming!"

Press the green flag. The sprite zooms across, and the moment it touches the edge it turns around and heads back — then keeps zooming. It's making a decision every single loop.

Ask: "When the sprite is in the middle of the stage, which mouth runs — the top or the else?" (The else — because it's not touching the edge yet.)


0:30 · Activity — Build a sprite that reacts (22 min)

Students build their own reacting sprite. Demo the first two steps, then let them go and circulate.

  1. Open a new project at Scratch.
  2. Build the bouncing script: when green flag clicked → forever → move 10 steps → if <touching [edge]?> then → turn ↻ 180 degrees. Press the green flag — the sprite should ping-pong across the stage.
  3. Add a key reaction: inside the same forever, add a second if <key [space] pressed?> then → say "Boing!". Now it talks back when you press space.
  4. Try else: swap one if for an if … else and make the sprite do something different for no — like next costume when it's not touching the edge.
  5. Extra: use if <mouse down?> then → go to [mouse-pointer] so the sprite jumps to your cursor while you hold the button.

Circulate and ask: "Show me the question in your diamond. What runs when the answer is no?"

Debrief: ask 2–3 students to share their screen and show their sprite reacting — bouncing off the edge or answering a key press.


0:52 · Check for understanding (5 min)

Ask these aloud or in the chat. Answer key (for you):

  1. What does the if <> then block do? → It runs the blocks inside it only when the question in the diamond is true (yes); if it's false, Scratch skips them.
  2. Where do the yes/no questions like touching [edge]? come from? → From Sensing (cyan) — they're the diamond-shaped blocks that fit the < > hole.
  3. What's the difference between if … then and if … then … else? → Plain if runs its blocks only on yes and does nothing on no. if … else has two paths: the top runs on yes, the else part runs on no.

0:57 · Wrap-up + homework (3 min)


Teaching notes

Vocabulary

Term Meaning
Condition The yes/no question a decision is based on
if–then A block that runs its inside blocks only when the condition is true
else The second path — runs when the condition is false
Sensing block A cyan block that asks about the world (touching, key, mouse)
Boolean A value that is only ever true or false (the diamond shape)

Resources

Practice set

Extra tasks to explore decisions and Sensing. Work them easy → hard, at lab time or for homework. Answers follow each arrow.

1. Colour clue. You want a yes/no question like "am I touching the mouse-pointer?" Which colour block do you look for? → Cyan — Sensing.

2. True or false. A sprite is sitting in the middle of the stage. Is touching [edge]? true or false right now? → False — it's not touching the edge, so an if using it would be skipped.

3. Fix it (spot the bug). A student's if <> then → say "Hi!" never says anything, even though the block is snapped in fine. What's wrong? → The diamond is empty — there's no question, so it can never be true. Drop a Sensing block into the < >.

4. Predict. The script is forever → if <key [space] pressed?> then → next costume. What happens when you hold the space bar? → The sprite flips through its costumes over and over (animates) for as long as space is held; when you let go, it stops.

5. Make it (build task). Build a script so that when you click and hold the mouse, the sprite says "You clicked me!" → forever → if <mouse down?> then → say "You clicked me!".

6. Two paths (harder). Make a sprite that moves, and turns around at the edge but changes colour everywhere else.when green flag clicked → forever → move 10 steps → if <touching [edge]?> then → turn cw 180 degrees → else → change color effect by 5. The else runs on every loop where it's not at the edge.

Going deeper (optional)

Optional — for a class that's built a reacting sprite and wants to know why decisions matter.

Every game is just decisions. Point out that every video game they've ever played is thousands of if blocks running very fast: if the player touches a coin, add a point; if health is zero, game over; if the down arrow is pressed, crouch. The diamond questions are the game's senses, and the if blocks are its brain. Once students see this, they start spotting "that's an if–then!" in games they play — which is exactly the programmer's habit of mind we want.

The diamond shape is a promise. Notice that Sensing and Operators blocks are pointy diamonds, and the if hole is the same pointy shape — so only a true/false block will fit. Scratch is using shape to teach a rule: a decision needs a yes/no question, not a number or a word. That true-or-false idea has a real name programmers use everywhere — a Boolean.

Common mistakes & fixes

Next session

Session 6 — Keep Score with Variables: students make a variable — a labelled box that remembers a number — and use set and change to keep score, so clicking a target makes the score go up on the stage.

Ibnovate · Build · Innovate
Type to search · Esc to close
Welcome back
Sign in to continue building.
Accounts are created by Ibnovate — ask your instructor for your login.
🔒