Skip to content
Technologies · Year 5 · Algorithmic Logic and Sequences · Term 1

Branching Logic: If-Then-Else Decisions

Students will use 'if-then-else' logic to create programs that can make decisions based on specific conditions.

ACARA Content DescriptionsAC9TDI6P04

About This Topic

Branching logic teaches students to use 'if-then-else' statements, which allow programs to make decisions and follow different paths based on conditions. In Year 5 Technologies, students create simple programs in block-based languages like Scratch, such as a game where a cat jumps if a spacebar is pressed or walks otherwise. They explain how conditions control flow, design scenarios like automated doors, and evaluate how changing a condition alters outcomes, aligning with AC9TDI6P04.

This content builds algorithmic thinking and connects to sequences from earlier units, preparing students for more complex coding. It mirrors real-world applications in apps, robots, and games, helping students see programming as a tool for solving problems. Through tracing branched algorithms on paper or digitally, they develop precision in logic and prediction skills essential for digital solutions.

Active learning excels here because students receive instant feedback from running code, encouraging rapid iteration and experimentation. Collaborative debugging in pairs reveals flawed conditions quickly, while sharing programs class-wide sparks ideas for improvements and reinforces evaluation.

Key Questions

  1. Explain how conditional statements guide a program's flow.
  2. Design a scenario where 'if-then-else' logic is essential for a program's function.
  3. Evaluate the impact of changing a condition on a program's outcome.

Learning Objectives

  • Design a simple game or animation using 'if-then-else' statements to control character actions based on user input.
  • Explain how conditional statements direct the sequence of operations within a program.
  • Analyze the outcome of a program by tracing the execution path of 'if-then-else' logic with given inputs.
  • Evaluate the effectiveness of an 'if-then-else' structure in solving a specific problem, such as guiding a character through a maze.

Before You Start

Sequencing Instructions

Why: Students need to understand that programs follow a specific order of instructions before they can learn how to alter that order with decisions.

Basic Programming Concepts (e.g., sprites, events)

Why: Familiarity with fundamental building blocks of block-based programming, like events triggering actions, is necessary to introduce conditional logic.

Key Vocabulary

Conditional StatementA programming statement that executes a block of code only if a specific condition is true. It allows programs to make decisions.
If-Then-Else LogicA control flow structure where a program checks a condition. If true, it performs one action (then); otherwise, it performs a different action (else).
ConditionA statement that can be evaluated as either true or false, used to determine which path a program should take.
Boolean ValueA value that can only be true or false, often used as the result of a condition in programming.

Watch Out for These Misconceptions

Common MisconceptionIf-then-else always executes both branches.

What to Teach Instead

Programs follow only one path based on the condition's truth value. Flowchart activities help students draw single-path diagrams and test predictions, clarifying exclusive execution during pair traces.

Common MisconceptionConditions only check for equality.

What to Teach Instead

Conditions use operators like greater than or less than for ranges. Experimenting with number comparisons in games shows variety; group challenges with varied inputs build flexible thinking.

Common MisconceptionBranch order does not affect outcomes.

What to Teach Instead

Execution follows the written sequence after condition checks. Step-through debugging in small groups highlights how misplaced else clauses change flow, promoting careful planning.

Active Learning Ideas

See all activities

Real-World Connections

  • Traffic lights use 'if-then-else' logic. If the light is red, then stop; else if the light is yellow, then prepare to stop; else (if green), then go. This ensures safe traffic flow.
  • Automated doors in supermarkets operate on conditional logic. If a sensor detects motion within a certain range, then the doors open; else, they remain closed. This provides convenient access.
  • Video games employ branching logic extensively. For example, if a player presses the jump button, then the character jumps; else if the player presses the move forward button, then the character moves forward. This creates interactive gameplay.

Assessment Ideas

Exit Ticket

Provide students with a simple flowchart for a program that uses 'if-then-else'. Ask them to write down the output of the program for two different starting inputs, explaining how the conditions were met or not met.

Quick Check

Present students with a scenario, such as 'A robot needs to water plants.' Ask them to write down an 'if-then-else' statement that the robot could use, specifying the condition, the 'then' action, and the 'else' action.

Discussion Prompt

Ask students to share a program they created or observed. Prompt them to explain: 'Where in this program does the code make a decision? What condition is being checked, and what happens if that condition is true versus false?'

Frequently Asked Questions

How does branching logic fit AC9TDI6P04?
AC9TDI6P04 requires implementing algorithms with sequences and branching for Year 5. Students design, trace, and modify if-then-else programs to control events, directly meeting standards through practical coding tasks that demonstrate decision-making in digital solutions.
What are common errors in if-then-else coding for kids?
Students often nest conditions wrongly or forget else clauses, leading to incomplete paths. Others misuse operators, like confusing '==' with '>'. Targeted debug stations with peer review correct these by comparing code outputs to expected behaviors, building accuracy over time.
How can active learning help teach branching logic?
Active approaches like live coding and testing provide immediate visual feedback on condition outcomes, making logic tangible. Pair programming fosters discussion of 'what if' scenarios, while group demos encourage evaluating changes collectively. These methods reduce abstraction, boost engagement, and deepen retention through hands-on iteration.
Ideas for assessing if-then-else understanding?
Use rubrics for program functionality, condition accuracy, and outcome predictions. Have students trace branched flowcharts, modify code to test hypotheses, or explain changes verbally. Portfolios of before-after code versions show growth in evaluation skills.