Skip to content
Computing · Year 7 · Computational Thinking and Logic · Autumn Term

Selection: Making Decisions (If/Else)

Implementing conditional statements (if-then-else) to allow programs to make decisions based on conditions.

National Curriculum Attainment TargetsKS3: Computing - Programming and Development

About This Topic

Selection with if-else statements lets programs make decisions based on true or false conditions, a key part of computational thinking. Year 7 students use Scratch to add if-then-else blocks, for example, making a sprite jump if it touches a colour or stop if a score reaches ten. Clear conditions like 'touching edge?' or 'key space pressed?' guide program flow and prevent unexpected behaviour.

This topic aligns with KS3 Computing standards in programming and development, within the Autumn unit on computational thinking and logic. Students explain how selection controls outcomes, construct responsive scripts, and evaluate condition clarity to debug effectively. It connects logic to real-world decisions, like traffic lights or games.

Active learning suits this topic well. Students test code live in Scratch, see results instantly, and adjust conditions through trial and error. Collaborative challenges build confidence as peers share fixes, turning logic errors into shared discoveries.

Key Questions

  1. Explain how selection allows a program to make decisions.
  2. Construct a Scratch script that uses an 'if-else' block to control sprite behavior.
  3. Evaluate the importance of clear conditions in selection statements.

Learning Objectives

  • Construct a Scratch program that uses an if-else statement to control sprite actions based on a specific condition.
  • Explain how a true or false condition within an if-else block directs program flow.
  • Evaluate the clarity and effectiveness of conditions used in selection statements to predict program behavior.
  • Modify an existing Scratch script to implement a new decision-making process using if-else logic.

Before You Start

Sequencing: Ordering Instructions

Why: Students need to understand how to arrange instructions in a specific order before they can learn to control that order with conditions.

Events: Responding to Triggers

Why: Understanding how programs react to events like 'when green flag clicked' or 'when key pressed' is foundational for setting up conditions.

Key Vocabulary

SelectionA programming construct that allows a program to execute different blocks of code based on whether a condition is true or false.
Conditional StatementA statement in programming that performs different computations or actions depending on whether a programmer-defined boolean condition evaluates to true or false.
If-Else StatementA control flow statement that executes one block of code if a specified condition is true, and another block of code if the condition is false.
ConditionA logical expression that evaluates to either true or false, used to determine which path of execution a program should take.

Watch Out for These Misconceptions

Common MisconceptionIf-else always runs both branches.

What to Teach Instead

Programs check the condition once; only one branch executes. Use think-pair-share where students predict outcomes for given code, then run it in Scratch to compare predictions and correct mental models through evidence.

Common MisconceptionAny text in the condition works.

What to Teach Instead

Conditions must evaluate to true or false, using operators like equals or greater than. Hands-on debugging stations let students fix broken conditions collaboratively, revealing why vague inputs fail and building precise testing habits.

Common MisconceptionNesting if-else makes code too complex.

What to Teach Instead

Simple nests handle multiple decisions, like if-then-else if-else. Group code reviews show students how nests organise logic without confusion, as they trace paths together on paper before coding.

Active Learning Ideas

See all activities

Real-World Connections

  • Traffic light systems use conditional logic. If the sensor detects a car waiting, and the light is red, it remains red; otherwise, it might change to green after a set time, managing traffic flow in urban areas.
  • Video game developers use if-else statements extensively. For example, if a player presses the 'jump' button and the character is on the ground, the character jumps; else, it remains still.

Assessment Ideas

Quick Check

Present students with a simple Scratch script snippet containing an if-else block. Ask them to predict what the sprite will do if a specific condition is met (e.g., 'What happens if the sprite touches the blue color?').

Exit Ticket

Ask students to write down one example of a condition they could use in a Scratch game to make a sprite react differently. Then, have them describe what the sprite should do if the condition is true and what it should do if it is false.

Discussion Prompt

Pose the question: 'Why is it important for the condition in an if-else statement to be very clear and specific?' Facilitate a brief class discussion, guiding students to consider how vague conditions can lead to unexpected program behavior.

Frequently Asked Questions

How do I teach if-else statements in Scratch for Year 7?
Start with a whole-class demo of a sprite that turns if touching an edge, else continues. Provide templates with gaps for conditions. Let students extend to games, emphasising testing each branch. This scaffolds from simple to nested logic over two lessons.
What are common errors in if-else conditions?
Students often use assignment (=) instead of comparison (==), or forget quotes around text. Others mix variables without sensing blocks. Address with error galleries: display buggy code, have pairs fix and explain in Scratch, reinforcing operator rules through practice.
How can active learning improve understanding of if-else in programming?
Active approaches like pair coding and relay builds give instant feedback in Scratch, so students see wrong paths fail live. Collaborative debugging shares strategies, while challenges like condition hunts make abstract logic concrete. This boosts retention as students iterate and explain their fixes to peers.
What extensions for advanced Year 7 if-else skills?
Introduce nested if-else or combine with loops for games like rock-paper-scissors. Challenge students to optimise conditions with variables. Peer teaching, where experts demo custom projects, extends skills while reviewing basics like boolean logic.