Skip to content

Week 5 — Conditionals: Teaching a Program to Decide

At a glance

Date Friday, September 11, 2026
Unit 1 — Think Like a Machine
Big idea Conditionals let a program choose different actions based on whether something is true.
Goal Students add one meaningful if decision to their Arcade game.
Student accounts needed None. MakeCode autosaves in the browser.
Prep time 5 minutes

Why this lesson looks the way it does

Students often think conditionals are "if you press A." That is close, but events and conditionals are different: events say when to check; conditionals say what decision to make. This lesson keeps that distinction explicit because they learned events in Week 2.

The decision should matter to the game. "If score is greater than 10, speed up" is better than a decorative message because the player can feel the rule. Older students can write the Boolean expression in JavaScript; younger students can read it as a sentence.


CSTA 2026 standards

Concept area Connection
Algorithms & Design Algorithms can include decisions that choose between paths
Programming Conditional statements run code only when a Boolean condition is true
Data & Analysis Programs compare changing values such as score, time, or lives
Systems & Security Rule thresholds control how a system responds to changing inputs
Computing & Society Software decisions are designed by people and depend on chosen rules

"I can…" objectives

By the end of today, students can say:

  • I can explain an if statement as a question the program checks.
  • I can use a comparison like score > 10.
  • I can make my game behave differently when a condition is true.
  • I can identify the condition in JavaScript.

Teacher prep — the 5-minute version

  1. Open https://arcade.makecode.com with a small scoring project.
  2. Be ready to demo: if score > 5 then change speed or show message.
  3. Write on the board:

    Last Friday: Variables remember
    Today: Conditionals decide
    Sentence frame: IF ___ is true, THEN ___

  4. Put > < = on the board with words: greater than, less than, equal to.
  5. Plan the Driver/Navigator swap at 0:24.

Minute-by-minute run sheet

0:00–0:04 — Anchor

"Last Friday we made the game remember a number like score or lives. This Friday we ask the program a question about that number. If the answer is yes, it does one thing. If not, it keeps going."

Point to the board:

"IF it is raining, THEN bring an umbrella. The computer version is less poetic, but it is the same shape."


0:04–0:12 — Mini-lesson: events check, conditionals decide

On the projector, use a scoring project. Add an if inside an event or loop:

  • When A is pressed, change score by 1.
  • If score is greater than 5, set player speed to 150 or say "Level 2!"

Think aloud:

"The A-button event tells the program when to run this code. The if block asks a question after the score changes: is the score greater than 5? At first, no. Later, yes. Same code, different result because the variable changed."

Press A until the condition becomes true.

Toggle to JavaScript and point to the condition:

"This line is the decision: if (info.score() > 5). Parentheses hold the question. Curly braces hold what happens if the answer is yes."


0:12–0:36 — Paired build

Required build:

  1. Use a game that has a changing value: score, lives, timer, or speed.
  2. Add one if decision connected to that value.
  3. Make the decision visible or playable.
  4. Test both sides: before the condition is true and after it becomes true.

"A good conditional is testable. If you cannot make it false and then make it true, you do not really know whether it works."

Driver/Navigator swap at 0:24.

"Swap. New Driver, your job is to prove the if works. First test when it should not run. Then test when it should."

Tiered challenges

  • 🟢 Starter (gr 5–6): If score is greater than 5, make the player say "Level 2!" or change color.
  • 🟡 Builder (gr 7–8): If score is greater than 10, make the game harder by increasing obstacle speed or spawning faster.
  • 🔴 Extender (gr 9–10): Toggle Blocks → JavaScript. Edit the comparison in code (>, <, or ==). Add an else branch so the game does one thing before the threshold and another after it.

The likely misconception

When students say "the if made the score go up," separate cause and decision: the event changed the score; the conditional checked the score.


0:36–0:42 — Share-out

Choose a project where the conditional clearly changes gameplay.

"Read your rule as an English sentence: IF , THEN . Now show us the moment it becomes true."

Ask the room:

"What would happen if the number were 100 instead of 10? Easier, harder, or impossible to trigger?"


0:42–0:45 — Teaser + prompt

"Next Friday we make objects interact when they touch. That is where the pieces become a real game: player, collectible, obstacle, collision. The prompt is below."


Share-out prompt

"What question does your program ask, and what happens when the answer is yes?"

🤔 Think About This

Notice one everyday rule that works like an if: if your battery is low, your phone warns you; if a door sensor sees motion, it opens; if a cart total is high enough, shipping changes.

Ask: who chose that threshold?


🔌 Unplugged Plan B — if the internet is down

Use classroom rules as conditionals.

Time Activity
0:00–0:04 Anchor: variables remember; conditionals decide.
0:04–0:12 Human if statements. Teacher reads rules: "If you are wearing blue, stand"; "If your birthday is after June, clap once." Discuss true/false.
0:12–0:22 Score threshold game. Each pair has a score card starting at 0. Draw event cards: +1, +2, -1. Rule: if score > 5, enter Level 2 and change the action.
0:22–0:34 Pairs design a paper game with one variable and one if/then rule. They must test before and after the threshold.
0:34–0:41 Trade games. Players read the rule as "IF ___ THEN ___" before playing.
0:41–0:45 Teaser collisions and Think About This.

Push precision: "greater than 5" is not the same as "5 or more." That matters in code.


Common problems & fixes

Problem Fix
Conditional never triggers Check the comparison and threshold. If score only reaches 5, score > 5 will not run. Use >= if available or lower the threshold.
Conditional triggers immediately The starting value may already satisfy the condition. Ask what score/lives is at the start.
Student confuses event with conditional Use the sentence: event = when to check; conditional = what question to ask.
Game becomes impossible after difficulty increase Tune one number at a time. Fair challenge beats chaos.
JavaScript = vs == confusion Explain only as needed: one sets a value, the other compares. If it derails, return to Blocks.

Vocabulary

  • Conditional — code that runs only if a condition is true
  • Condition — the question being checked
  • Boolean — a true/false value
  • Comparison — checking values with symbols like >, <, or =
  • Threshold — the value where a rule starts to apply

Reflection — fill in after class

  • Did students test both false and true cases?
  • Which comparison symbols caused confusion?
  • Did students build decisions that affected gameplay, not just decoration?
  • Who is ready to use else next time?

Next week: Week 6 — Sprites & Collisions: When Things Touch