Skip to content
Computing · Year 4 · Computational Logic and Repetition · Autumn Term

Conditional Logic: If/Then Statements

Introducing 'if/then' statements to make programs respond differently based on conditions.

National Curriculum Attainment TargetsKS2: Computing - Programming and Algorithms

About This Topic

Conditional logic introduces 'if/then' statements, which allow programs to make decisions and respond differently based on specific conditions. In Year 4, students predict how a program behaves with an 'if/then' statement, design simple programs that change actions according to conditions, and explain the role of conditionals in everyday scenarios like games or traffic lights. This aligns with KS2 Computing standards on programming and algorithms, building skills in prediction, logical design, and real-world application.

These statements form the basis of more complex programming, connecting to decomposition by breaking problems into conditional paths and abstraction by focusing on key decisions. Students see how conditionals create responsive systems, such as a character jumping only if a key is pressed or a score increasing if a target is hit. This topic strengthens computational thinking while linking to mathematics through logical sequences.

Active learning suits this topic well because students quickly grasp abstract ideas through tangible trials. Unplugged sorting games or block-based coding let them test predictions immediately, debug errors collaboratively, and iterate designs, making logic concrete and boosting confidence in programming.

Key Questions

  1. Predict how a program will behave with an 'if/then' statement.
  2. Design a program that uses a condition to change its actions.
  3. Explain the purpose of a conditional statement in everyday life.

Learning Objectives

  • Design a simple game or animation using 'if/then' statements to control character actions based on user input.
  • Predict the output of a given block of code containing 'if/then' statements.
  • Explain how conditional logic is used in traffic light systems to manage vehicle flow.
  • Compare the behavior of a program with and without an 'if/then' statement.

Before You Start

Sequencing Instructions

Why: Students need to understand how to order instructions correctly before they can introduce conditional logic that alters the sequence.

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

Why: Familiarity with how programs respond to events, like clicking a sprite, is helpful for understanding when conditions are checked.

Key Vocabulary

Conditional StatementA programming statement that performs an action only if a specific condition is true. It allows programs to make decisions.
If/Then StatementA type of conditional statement where the program checks if a condition is met. If it is true, a specific action or set of actions is executed.
ConditionA test or question within an 'if/then' statement that evaluates to either true or false. For example, 'Is the score greater than 10?'
BooleanA data type that can only have one of two values: true or false. Conditions in 'if/then' statements often result in a boolean value.

Watch Out for These Misconceptions

Common MisconceptionAn 'if/then' statement always runs both the 'if' and 'else' actions.

What to Teach Instead

Conditionals execute only the matching branch: 'then' if true, 'else' if false. Role-playing as the program with student volunteers clarifies this flow, as groups act out paths and see single outcomes emerge from peer testing.

Common MisconceptionThe order of conditions does not affect program behavior.

What to Teach Instead

Programs evaluate conditions sequentially, so order matters for nested or chained logic. Collaborative debugging circuits, where students rearrange blocks and observe changes, reveal this dependency through hands-on prediction and trial.

Common MisconceptionConditions are always simple true/false without user input.

What to Teach Instead

Real conditions often use variables or sensors. Pair programming with input blocks shows dynamic responses, helping students connect static predictions to interactive programs via iterative testing.

Active Learning Ideas

See all activities

Real-World Connections

  • Video game developers use conditional logic extensively. For example, an 'if/then' statement might make a character jump only if the spacebar is pressed, or an enemy might attack if the player comes within a certain range.
  • Traffic light systems in cities like London employ conditional logic. An 'if/then' statement could be programmed so that if a car is detected at an intersection (the condition), the light turns green for that direction (the action).

Assessment Ideas

Exit Ticket

Provide students with a simple scenario, such as 'If the player touches a coin, then add 10 points.' Ask them to write down what the condition is and what the action is. Then, ask them to describe what happens if the player does not touch a coin.

Quick Check

Show students a short block-based code snippet with an 'if/then' statement (e.g., 'if touching color blue, then say 'Hello''). Ask them to predict what the program will do when run. Then, run the code and ask them to explain any differences between their prediction and the actual outcome.

Discussion Prompt

Ask students to think about a common household appliance, like a microwave. Prompt them: 'What is one 'if/then' rule that the microwave follows? For example, 'If the timer is set and the start button is pressed, then begin cooking.' Discuss their examples and how the appliance behaves differently based on these conditions.

Frequently Asked Questions

What block-based tools work best for Year 4 if/then statements?
ScratchJr or Scratch suit Year 4 perfectly with visual 'if/then' blocks and sprites for immediate feedback. Start with sensing blocks like 'touching color?' to keep it simple. These tools match UK curriculum progression, allowing export of projects for portfolios while supporting offline use.
How can I assess understanding of conditional logic?
Use prediction sheets where students draw or describe program outputs before running code, then compare. Portfolios of before/after designs show iteration skills. Oral explanations of everyday conditionals, like fridge lights, reveal transfer of concepts beyond screens.
How does active learning help teach if/then statements?
Active approaches like unplugged role-play and pair coding make logic visible and testable right away. Students predict, test, and debug in real time, which corrects misconceptions faster than passive watching. Group shares build vocabulary and confidence, turning abstract syntax into intuitive decision trees.
How to link conditionals to everyday life in Year 4?
Draw parallels to games with rules like 'if you roll a 6, then move extra', or home devices like 'if door opens, then light on'. Students design programs mimicking these, explaining logic in journals. This reinforces purpose and aids retention across contexts.