Skip to content

Branching (Selection) in AlgorithmsActivities & Teaching Strategies

Active learning helps Year 7 students grasp branching in algorithms because it turns abstract conditionals into tangible, visual, and collaborative experiences. When students physically sort cards, draw flowcharts, or debug together, they see how selection structures control program flow in real time, making the concept stick faster than passive note-taking.

Year 7Technologies4 activities30 min45 min

Learning Objectives

  1. 1Design an algorithm that uses multiple if/else statements to control a character's actions in a simple game.
  2. 2Predict the output of a pseudocode algorithm containing nested conditional statements for a given set of inputs.
  3. 3Explain how selection structures (if/else) enable algorithms to make decisions based on specific criteria.
  4. 4Compare the outcomes of two algorithms that differ only in the conditions used within their selection structures.
  5. 5Justify the choice of specific conditions within an if/else statement to achieve a desired algorithmic behavior.

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

30 min·Small Groups

Unplugged: Condition Card Sort

Provide cards with conditions and actions for scenarios like library book sorting. Students in small groups arrange cards into branching paths on paper. Test paths by inputting sample data and adjust based on group predictions.

Prepare & details

Design an algorithm that incorporates multiple branching conditions.

Facilitation Tip: During Condition Card Sort, circulate and ask each pair to explain why they placed a card in a particular group, reinforcing the idea that conditions evaluate to true or false only.

Setup: Flexible space for group stations

Materials: Role cards with goals/resources, Game currency or tokens, Round tracker

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making
40 min·Pairs

Flowchart to Pseudocode Pairs

Pairs design flowcharts for problems like eligibility checks, then convert to pseudocode with if/else. Exchange with another pair to predict and trace three input cases. Discuss discrepancies.

Prepare & details

Predict the outcome of an algorithm with complex nested conditions.

Facilitation Tip: In Flowchart to Pseudocode Pairs, require students to swap their final flowcharts and trace each other’s logic with a different input to test accuracy.

Setup: Flexible space for group stations

Materials: Role cards with goals/resources, Game currency or tokens, Round tracker

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making
35 min·Small Groups

Nested Debug Relay

Prepare buggy pseudocode with nested ifs. Small groups relay: one traces an input, passes to next for correction, until fixed. Whole group verifies with multiple tests.

Prepare & details

Justify the use of selection structures in decision-making processes.

Facilitation Tip: During Branching Game Builder, limit the number of condition checks per group to encourage efficient, readable branching rather than overly complex nested structures.

Setup: Flexible space for group stations

Materials: Role cards with goals/resources, Game currency or tokens, Round tracker

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making
45 min·Individual

Branching Game Builder

Individuals create simple text-based games using if/else for player choices. Share and playtest in pairs, noting path predictions. Refine based on tester feedback.

Prepare & details

Design an algorithm that incorporates multiple branching conditions.

Facilitation Tip: In Nested Debug Relay, provide a single shared pseudocode snippet to all groups so they focus on tracing the path rather than rewriting the entire algorithm.

Setup: Flexible space for group stations

Materials: Role cards with goals/resources, Game currency or tokens, Round tracker

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making

Teaching This Topic

Teach branching by starting with real-world analogies students know well, like vending machines or traffic lights, to ground the concept in familiar decision-making. Avoid rushing to code; let students struggle slightly with tracing flowcharts first, as research shows this improves their later debugging skills. Emphasize that conditions are not linear checks but hierarchical and conditional, which helps prevent the common misconception that all branches always run.

What to Expect

Successful learning looks like students confidently tracing and predicting paths in conditional structures, explaining why only one branch runs per condition, and using nested conditions correctly in their own pseudocode or game logic. They should also identify and fix logical errors in branching statements during peer reviews.

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 Condition Card Sort, watch for students placing both 'if true' and 'if false' branches in the same group, indicating they believe both execute.

What to Teach Instead

Ask students to trace one card’s condition with a given input, then physically move only the matching branch to the 'executed' pile, showing that only one path runs based on the condition’s truth value.

Common MisconceptionDuring Nested Debug Relay, watch for students evaluating inner conditions without considering whether the outer condition was true, suggesting they miss the dependency between levels.

What to Teach Instead

Provide a sticky note for each group to mark which outer branches execute, then have them trace inner conditions only within those marked paths, emphasizing the hierarchy.

Common MisconceptionDuring Flowchart to Pseudocode Pairs, watch for students assuming that the order of multiple if statements without else-if does not change the outcome, indicating they overlook skipped conditions.

What to Teach Instead

Have students swap flowcharts with another pair and test with the same input, then adjust the order of conditions in their pseudocode to observe how priority shifts the result.

Assessment Ideas

Quick Check

After Condition Card Sort, give students a pseudocode snippet with an if/else statement and a specific input. Ask them to write the final output and explain which branch ran, then collect and review responses to check for understanding of single-path execution.

Exit Ticket

After Flowchart to Pseudocode Pairs, ask students to draw a simple flowchart for a number classifier (positive, negative, zero) and label each decision box with its condition. Collect these to assess their ability to structure nested branching correctly.

Discussion Prompt

During Branching Game Builder, pose this question: 'Why is the order of your conditions important for your game’s logic? What happens if you swap two conditions?' Listen for explanations about skipped branches or priority, and note students who cite specific examples from their own projects.

Extensions & Scaffolding

  • Challenge students to add a third condition in their Branching Game Builder, such as an 'else if' for edge cases.
  • For students struggling with nested conditions, provide a partially completed flowchart with color-coded branches to highlight dependencies.
  • Deeper exploration: Have students research and implement a binary search algorithm using branching, then compare its efficiency to a linear search in terms of steps.

Key Vocabulary

Conditional StatementA programming structure that executes a certain block of code only if a specific condition is true. This is often written as 'if'.
Selection StructureA control flow statement that allows a program to choose between different paths of execution based on whether a condition evaluates to true or false. Common examples are 'if', 'if-else', and 'else-if'.
BranchingThe process within an algorithm where the execution path can diverge into two or more possibilities based on a condition being met or not met.
Nested ConditionA conditional statement placed inside another conditional statement, allowing for more complex decision-making logic.
Boolean ExpressionAn expression that evaluates to either true or false, used as the condition in selection structures.

Ready to teach Branching (Selection) in Algorithms?

Generate a full mission with everything you need

Generate a Mission