Skip to content

Conditional Statements: If/Then LogicActivities & Teaching Strategies

Active learning works for conditional statements because students need to experience cause-and-effect firsthand. When they see a sprite respond to a key press or edge detection, the abstract concept of 'if-then' logic becomes concrete and memorable. Hands-on activities transform confusion into clarity by letting students debug and refine their own conditions.

Year 3Computing4 activities20 min35 min

Learning Objectives

  1. 1Explain how an 'if-then' statement enables a program to execute different actions based on a condition.
  2. 2Compare the execution flow of a program using conditional statements to one that follows a simple sequence.
  3. 3Construct a simple program where a sprite's behavior changes based on a specific condition being met.
  4. 4Identify the condition and the action within a given 'if-then' programming block.

Want a complete lesson plan with these objectives? Generate a Mission

30 min·Pairs

Pair Programming: Edge Detection Challenge

Pairs log into Scratch Juniors and program a sprite to move forward. Add an 'if touching edge, then turn' condition. Test runs, swap roles to debug partner's code, and share successes with the class.

Prepare & details

Explain how an 'if-then' statement allows a program to make decisions.

Facilitation Tip: During Pair Programming: Edge Detection Challenge, circulate and ask partners to explain why their sprite reacts only at the edge, not elsewhere on the screen.

Setup: Groups at tables with access to research materials

Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
35 min·Small Groups

Small Groups: Key Press Game

In small groups, create a sprite that jumps if the spacebar is pressed using 'if key pressed, then jump'. Add a second condition for colour change. Groups demo their games and vote on the most creative.

Prepare & details

Compare a program with conditions to one that simply follows a sequence.

Facilitation Tip: In Small Groups: Key Press Game, remind students to test each condition with different inputs before claiming their game works.

Setup: Groups at tables with access to research materials

Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
25 min·Whole Class

Whole Class: Traffic Light Simulation

Project a shared program. Class votes on conditions like 'if red light, then stop'. Students suggest tweaks, then replicate individually on tablets. Discuss why conditions make it realistic.

Prepare & details

Construct a simple program where a sprite changes behavior based on a condition.

Facilitation Tip: For Whole Class: Traffic Light Simulation, pause the activity after each step to have students predict what will happen before revealing the outcome.

Setup: Groups at tables with access to research materials

Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills
20 min·Individual

Individual: Sprite Decision Tree

Each student builds a choose-your-own-adventure for a sprite: if click left, go one way; if right, another. Test against checklist of conditions, then peer review one.

Prepare & details

Explain how an 'if-then' statement allows a program to make decisions.

Facilitation Tip: During Individual: Sprite Decision Tree, ask students to sketch their decision paths before coding to reinforce logical planning.

Setup: Groups at tables with access to research materials

Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template

AnalyzeEvaluateCreateDecision-MakingSelf-ManagementRelationship Skills

Teaching This Topic

Experienced teachers approach this topic by starting with physical analogies, like traffic lights or simple games, before moving to code. They avoid rushing to abstract explanations and instead let students discover the need for conditions through trial and error. Research suggests that using visual flowcharts alongside code helps students grasp decision branches more effectively than text alone. Teachers should also model debugging by intentionally creating incorrect conditions and asking students to identify why the sprite isn’t responding as expected.

What to Expect

Successful learning looks like students confidently writing conditions that match specific states and actions. They should explain why a sprite moves only when a condition is true, and adjust code based on testing outcomes. Group discussions should include reasoning about true and false outcomes in their programs.

These activities are a starting point. A full mission is the experience.

  • Complete facilitation script with teacher dialogue
  • Printable student materials, ready for class
  • Differentiation strategies for every learner
Generate a Mission

Watch Out for These Misconceptions

Common MisconceptionDuring Pair Programming: Edge Detection Challenge, watch for students who think the sprite will always react to the edge, regardless of its position.

What to Teach Instead

Prompt partners to test the sprite at different screen positions and ask them to describe when the condition evaluates to true. Encourage them to adjust their code until the sprite reacts only at the edge.

Common MisconceptionDuring Small Groups: Key Press Game, watch for students who assume the 'then' action happens no matter what key is pressed.

What to Teach Instead

Have the group list all the keys they tested and which ones triggered the sound. Ask them to adjust their condition to include only the intended key.

Common MisconceptionDuring Individual: Sprite Decision Tree, watch for students who create sequences without conditions, assuming the sprite will always follow the same path.

What to Teach Instead

Ask them to compare their program to a linear sequence and explain how conditions add flexibility. Guide them to add at least one condition that changes the sprite’s behavior based on input.

Assessment Ideas

Exit Ticket

After Pair Programming: Edge Detection Challenge, provide students with a simple 'if touching edge' code block. Ask them to draw two scenarios: one where the condition is true and one where it is false, explaining their drawings in one sentence each.

Discussion Prompt

After Small Groups: Key Press Game, present two programs: one with a condition for the key press and one without. Ask students to discuss the differences in how the sprite behaves and which program is more responsive to user input.

Quick Check

During Whole Class: Traffic Light Simulation, ask students to hold up a green card if their traffic light changes correctly based on the timer, or a red card if it does not. Ask volunteers to explain the 'if' part of their condition.

Extensions & Scaffolding

  • Challenge: Ask students to add a second condition to their Key Press Game, such as playing a sound only if the key is pressed while the sprite is touching a specific color.
  • Scaffolding: Provide pre-written condition blocks for the Sprite Decision Tree activity, focusing their work on selecting the correct inputs and outputs.
  • Deeper Exploration: Introduce nested conditions in the Traffic Light Simulation, such as a pedestrian crossing button that only works when the light is red for cars.

Key Vocabulary

Conditional StatementA programming command that performs an action only if a specific condition is true. It's like a rule that the computer follows.
If-Then LogicA fundamental programming concept where a set of instructions (the 'then' part) is executed only when a stated requirement (the 'if' part) is met.
ConditionThe part of an 'if-then' statement that is checked to see if it is true or false. For example, 'if the sprite touches the edge'.
SequenceA series of instructions that are followed one after another in a specific order, without any decision-making involved.

Ready to teach Conditional Statements: If/Then Logic?

Generate a full mission with everything you need

Generate a Mission