Topic Guide

Conditions and Decisions

A condition is a question with a true or false answer. The answer decides which code runs.

Why this matters

Has the player reached safety? Is the quiz answer correct? Is the wall closer than 15 centimetres? Each question turns information into a decision the program can repeat reliably.

Beyond this topic

A thermostat compares the room temperature with a target. Below the target it heats; above it, it waits. The chosen boundary controls the behaviour.

Math and logic

Boolean question

A test whose answer is true or false.

If

Run these commands when the test is true.

If / else

Choose one of two paths.

Comparison

Check whether two values are equal or which one is larger.

Small examples

1

Quiz answer

Compare the response with the stored answer.

2

Safe zone

Set the game to WON when the player reaches the target.

3

Obstacle check

Turn when the distance reading falls below a limit.

4

Fuel warning

Show a warning when fuel drops below the chosen threshold.

Program connections

Where this topic appears.

Active now

Scratch & Game Design

Students author games, animations, simulations, and strange interactive stories while learning how events, rules, and state fit together.

Active now

Robotics

Students write commands, wire simple circuits, read sensors, and trace physical cause and effect through the Sense–Decide–Act loop.

Coming later

Roblox Studio / Lua

A possible later step from visual programming into Lua, 3D objects, events, and larger game rules.

Coming later

AI & Smart Machines

A possible later program for testing patterns, predictions, prompts, mistakes, and the limits of AI tools.

Common mistakes

Checking once

The program tests a changing condition only when the game starts.

Reversed comparison

The warning appears above the threshold instead of below it.

Overlapping outcomes

Win and loss can both become true without a priority rule.

Missing starting value

The condition reads a variable that was never initialized.

Put the idea to work

Read the Lesson
Scratch & Game Design Guided Project

Quiz of Questionable Knowledge

Build a quiz that checks answers, gives useful feedback, keeps score, and knows which question comes next.

  • Conditions
  • Variables
  • Input
  • Messages
See how it works
Scratch & Game Design Guided Project

Escape from the Giant Pigeon

Build a fast chase game with known positions, collision rules, win and loss states, and reliable restart behaviour.

  • Scratch
  • Coordinates
  • Movement
  • Collision
See how it works
Robotics Computer Lab Project

Robot Patrol Challenge

Design a repeating patrol that notices an obstacle, tries a response, and checks whether the response worked.

  • Loops
  • Sensors
  • Conditions
  • State
See how it works