Skip to content
Technologies · Foundation · Patterns and Sequences · Term 1

Simple Conditional Logic: If/Else

Students will explore basic conditional statements (if/else) to make programs respond differently based on simple conditions.

ACARA Content DescriptionsAC9TDEFP01

About This Topic

Simple conditional logic with if/else statements teaches students how programs can make decisions based on conditions. At Foundation level, children use block-based tools like ScratchJr to snap together if/else blocks, creating characters that respond differently, such as playing a sound if touching a red object or moving left if on a blue background. This builds on sequencing from earlier units and aligns with AC9TDEFP01, where students create and debug simple digital solutions to share ideas.

These concepts foster computational thinking by introducing branching paths in algorithms. Students predict outcomes, test conditions like position or color, and adjust code when results differ from expectations. Connections to everyday decisions, like choosing clothes based on weather, make the idea relatable and reinforce logical reasoning across the Technologies curriculum.

Active learning shines here because students immediately see cause-and-effect through running and tweaking their programs. Pair programming encourages explanation of choices, while whole-class demos reveal diverse solutions, helping everyone grasp that conditions create flexible, responsive code.

Key Questions

  1. Explain how an 'if' statement allows a program to make a decision.
  2. Design a program where a character changes behavior based on a condition (e.g., touching an object).
  3. Predict the path a program will take given a specific condition.

Learning Objectives

  • Explain how an 'if' statement directs a program to make a choice based on a specific condition.
  • Design a simple program using ScratchJr where a character's action changes when a condition is met, such as touching a specific color.
  • Predict the sequence of events in a block-based program given a set of 'if/else' conditions.
  • Modify a program to alter the outcome of an 'if/else' statement by changing the condition.
  • Identify the condition within an 'if/else' block that triggers a specific program response.

Before You Start

Sequencing Actions

Why: Students need to understand how to order instructions for a program to run correctly before introducing conditional logic.

Basic Block-Based Coding

Why: Familiarity with the interface and basic command blocks in tools like ScratchJr is necessary to build upon.

Key Vocabulary

ConditionA specific situation or requirement that must be true for something else to happen in a program.
If StatementA block of code that tells the program to do something only if a certain condition is met.
Else StatementA block of code that tells the program to do something different if the 'if' condition is not met.
Program DecisionWhen a program chooses between different paths or actions based on whether a condition is true or false.
Block-Based CodingA way of creating programs by snapping together visual blocks that represent commands and logic.

Watch Out for These Misconceptions

Common MisconceptionThe program always runs both if and else blocks.

What to Teach Instead

If/else creates branches: only one path executes based on the condition. Students test by changing inputs and observing single outcomes, which clarifies flow during pair debugging sessions.

Common MisconceptionConditions are fixed and never change.

What to Teach Instead

Conditions depend on runtime states like position or color. Hands-on dragging of sprites shows varying results, helping students predict and verify dynamic behavior in group shares.

Common MisconceptionIf block works alone without else.

What to Teach Instead

Without else, no action occurs if condition is false, leading to 'stuck' programs. Building complete if/else chains and testing edge cases in activities reveals the need for both paths.

Active Learning Ideas

See all activities

Real-World Connections

  • Traffic lights use 'if/else' logic: if the light is red, cars stop; else (if it is green), cars go. This ensures safe and orderly movement of vehicles.
  • Video game characters often react to player input or game events using conditional logic. For example, if the player presses the jump button, the character jumps; else, the character stands still.
  • Smart home devices use conditions to automate tasks. If the temperature drops below a certain point, the thermostat turns on the heating.

Assessment Ideas

Exit Ticket

Give students a simple ScratchJr project with an 'if/else' block. Ask them to draw what the character will do. Then, ask them to write one sentence explaining why the character will do that specific action.

Quick Check

Present students with two scenarios: 1. A character touches a blue square. 2. A character does not touch a blue square. Ask them to choose the correct block sequence for each scenario: 'If touching blue, say hello' or 'If not touching blue, say hello'.

Discussion Prompt

Ask students: 'Imagine you are designing a game where a character needs to collect coins. How could you use an 'if' statement to make the character get a point only when it touches a coin?' Listen for their use of 'if', 'touching', and 'score'.

Frequently Asked Questions

How do I introduce if/else to Foundation students?
Start with unplugged activities like sorting cards: if red, put left; else right. Transition to block coding with familiar sprites. Use large visuals and think-alouds to model snapping blocks, then let pairs experiment with simple touch conditions for quick success.
What block-based tools suit Foundation if/else?
ScratchJr or Code-a-Pillar work well: intuitive blocks for conditions like 'touching color'. Ensure tablets or computers per pair. Free apps align with ACARA, support offline modes, and offer starter projects to scaffold branching logic.
How can active learning help teach if/else?
Active approaches like pair coding and prediction challenges make abstract logic concrete: students run code, see branches activate, and debug live. Group demos expose variations, while physical reenactments with props build intuition before screens, boosting engagement and retention.
What if students' programs don't branch correctly?
Check block connections and condition setup first. Have them verbalize paths: 'If true, then... else...'. Class error-sharing sessions normalize debugging. Re-test with exaggerated inputs to highlight issues, turning mistakes into teachable moments.