Simple Conditional Logic: If/ElseActivities & Teaching Strategies
Active learning works for this topic because children physically move and test decisions, which makes abstract conditions concrete. When students pair up or manipulate objects, they see how code branches instantly change behavior, turning logic into something they can feel and adjust right away.
Learning Objectives
- 1Explain how an 'if' statement directs a program to make a choice based on a specific condition.
- 2Design a simple program using ScratchJr where a character's action changes when a condition is met, such as touching a specific color.
- 3Predict the sequence of events in a block-based program given a set of 'if/else' conditions.
- 4Modify a program to alter the outcome of an 'if/else' statement by changing the condition.
- 5Identify the condition within an 'if/else' block that triggers a specific program response.
Want a complete lesson plan with these objectives? Generate a Mission →
Pair Coding: Conditional Dance
Pairs select sprites and backgrounds. They add if/else blocks so the sprite dances differently if touching a music note (play sound) versus a stop sign (freeze). Test by dragging sprites and swap roles to debug.
Prepare & details
Explain how an 'if' statement allows a program to make a decision.
Facilitation Tip: During Pair Coding: Conditional Dance, remind pairs to take turns acting as the ‘computer’ to clarify which path runs when.
Setup: Open space or rearranged desks for scenario staging
Materials: Character cards with backstory and goals, Scenario briefing sheet
Small Groups: Object Collector
Groups build a game where a character collects stars: if touching star, grow bigger and cheer; else, say 'keep looking'. Include obstacles that trigger warnings. Groups demo and vote on best features.
Prepare & details
Design a program where a character changes behavior based on a condition (e.g., touching an object).
Facilitation Tip: For Small Groups: Object Collector, rotate the collector sprite manually to show how the condition updates in real time.
Setup: Open space or rearranged desks for scenario staging
Materials: Character cards with backstory and goals, Scenario briefing sheet
Whole Class: Prediction Challenge
Project a simple if/else program. Class predicts sprite actions for different starting positions. Run code, discuss matches, then pairs recreate and modify it.
Prepare & details
Predict the path a program will take given a specific condition.
Facilitation Tip: In Whole Class: Prediction Challenge, pause after each scenario to ask students to vote on outcomes before testing, reinforcing prediction habits.
Setup: Open space or rearranged desks for scenario staging
Materials: Character cards with backstory and goals, Scenario briefing sheet
Individual: Weather Responder
Each student codes an avatar that changes costume or message based on 'sunny' or 'rainy' backgrounds using if/else. Share one screen-wide.
Prepare & details
Explain how an 'if' statement allows a program to make a decision.
Facilitation Tip: For Individual: Weather Responder, circulate to check that students test edge cases, like pressing the rain button when the sun is already showing.
Setup: Open space or rearranged desks for scenario staging
Materials: Character cards with backstory and goals, Scenario briefing sheet
Teaching This Topic
Start by modeling a simple if/else in block code and narrating each step aloud. Avoid rushing to the else block; pause after the if so students notice when nothing happens if the condition is false. Research shows that young learners grasp conditional logic best when they physically act out the branches before coding them.
What to Expect
Successful learning looks like students using if/else blocks to make clear choices in their programs. They should explain why only one outcome happens at a time, debug mismatches between condition and action, and describe how changing inputs alters program behavior in predictable ways.
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
Watch Out for These Misconceptions
Common MisconceptionDuring Pair Coding: Conditional Dance, watch for students who move both dance moves at once, assuming both paths execute.
What to Teach Instead
Have them freeze after each move and ask, ‘Which one happened first?’ Use the dance cards to highlight that only one block runs based on the condition.
Common MisconceptionDuring Small Groups: Object Collector, watch for students who think the ‘else’ block runs if the object is already collected.
What to Teach Instead
Guide them to reset the object’s position between trials and ask, ‘What is the starting state?’ to reinforce that conditions check the current moment.
Common MisconceptionDuring Whole Class: Prediction Challenge, watch for students who ignore the initial setup and guess randomly.
What to Teach Instead
Ask them to point to the background color or sprite position before selecting the block, making conditions visible and explicit.
Assessment Ideas
After Pair Coding: Conditional Dance, give students a half-finished ScratchJr project with an ‘if/else’ block. Ask them to draw what the character will do and write one sentence explaining why the specific path was chosen based on the condition shown.
During Small Groups: Object Collector, present a scenario where the collector sprite is on a green background and ask students to choose the correct block sequence: ‘If touching green, play sound’ or ‘If not touching green, play sound,’ justifying their choice in one word.
After Whole Class: Prediction Challenge, ask students to describe how they would use an ‘if’ statement to make a coin disappear and add 10 points when the character touches it, listening for the use of ‘if,’ ‘touching,’ and ‘score’ in their explanations.
Extensions & Scaffolding
- Challenge: Add a third condition using nested if/else to change the character’s costume based on two simultaneous states (e.g., touching red AND not touching blue).
- Scaffolding: Provide pre-built if/else templates with missing conditions for students to fill in, reducing cognitive load while reinforcing the structure.
- Deeper: Introduce a ‘timer’ variable that switches the condition after 5 seconds, prompting students to think about time-based logic beyond simple triggers.
Key Vocabulary
| Condition | A specific situation or requirement that must be true for something else to happen in a program. |
| If Statement | A block of code that tells the program to do something only if a certain condition is met. |
| Else Statement | A block of code that tells the program to do something different if the 'if' condition is not met. |
| Program Decision | When a program chooses between different paths or actions based on whether a condition is true or false. |
| Block-Based Coding | A way of creating programs by snapping together visual blocks that represent commands and logic. |
Suggested Methodologies
More in Patterns and Sequences
Recognizing Simple Patterns
Students will identify and describe simple repeating patterns in various contexts (e.g., colors, shapes, sounds).
2 methodologies
Following Step-by-Step Instructions
Students will practice following and giving clear, sequential instructions for simple tasks, both unplugged and with basic digital tools.
2 methodologies
Creating Simple Sequences
Students will design and implement short sequences of actions or commands to achieve a specific outcome, using block-based coding or physical activities.
2 methodologies
Pattern Recognition in Data and Problem Solving
Applying pattern recognition techniques to analyze data, identify trends, and abstract commonalities in problem-solving contexts.
3 methodologies
Sequencing in Programming Constructs
Applying sequencing to programming constructs, understanding the order of operations, and designing step-by-step solutions for computational tasks.
3 methodologies
Ready to teach Simple Conditional Logic: If/Else?
Generate a full mission with everything you need
Generate a Mission