IF/ELSE StatementsActivities & Teaching Strategies
Active learning helps students grasp IF/ELSE statements because decision-making in code mirrors real-world choices. When learners physically act out conditions or debug live examples, abstract logic transforms into tangible understanding, making the concept stick better than passive notes or slides.
Learning Objectives
- 1Design a simple game scenario that uses an IF/ELSE statement to control character movement based on a condition.
- 2Explain how an ELSE block provides a default action when an IF condition is false.
- 3Justify the order of conditional checks in a script by predicting program behavior with different input sequences.
- 4Create a short program that demonstrates branching logic for at least two different outcomes.
Want a complete lesson plan with these objectives? Generate a Mission →
Unplugged: Condition Card Relay
Prepare cards with conditions like 'score > 50' and actions like 'win prize'. In relay, teams sequence cards into IF/ELSE chains on a board, justifying order. Then translate to Scratch code as a group.
Prepare & details
Explain how the 'else' block provides a safety net for our program.
Facilitation Tip: During Condition Card Relay, stand at the back to observe where students hesitate, then pause the game to address misunderstandings as a class.
Setup: Groups at tables with problem materials
Materials: Problem packet, Role cards (facilitator, recorder, timekeeper, reporter), Problem-solving protocol sheet, Solution evaluation rubric
Pair Programming: Score Quiz
Pairs use Scratch or Blockly to build a three-question quiz storing score in a variable. Add IF/ELSE for pass/fail messages based on final score. Swap and debug partner's code.
Prepare & details
Justify why the order of conditional checks is important in a script.
Facilitation Tip: In Pair Programming: Score Quiz, circulate to listen for students explaining their code to each other, as verbalizing reasoning deepens understanding.
Setup: Groups at tables with problem materials
Materials: Problem packet, Role cards (facilitator, recorder, timekeeper, reporter), Problem-solving protocol sheet, Solution evaluation rubric
Debugging Circuit: Buggy Branches
Set up five laptops with code having IF/ELSE errors like wrong order or missing ELSE. Pairs rotate, fix one bug per station, log fixes, then share solutions whole class.
Prepare & details
Design a simple quiz program using selection with IF/ELSE statements.
Facilitation Tip: For Buggy Branches, provide only one test case at a time to force students to isolate the bug step-by-step rather than guessing randomly.
Setup: Groups at tables with problem materials
Materials: Problem packet, Role cards (facilitator, recorder, timekeeper, reporter), Problem-solving protocol sheet, Solution evaluation rubric
Individual: Flowchart to Code
Students draw flowchart for a simple game choice like 'health < 20? heal or end'. Code it using variables and IF/ELSE, test inputs, refine based on outputs.
Prepare & details
Explain how the 'else' block provides a safety net for our program.
Facilitation Tip: During Flowchart to Code, insist students draw arrows between steps before writing code to ensure their logic matches their intended flow.
Setup: Groups at tables with problem materials
Materials: Problem packet, Role cards (facilitator, recorder, timekeeper, reporter), Problem-solving protocol sheet, Solution evaluation rubric
Teaching This Topic
Teach IF/ELSE by starting with concrete examples students can relate to, like game rules or classroom routines, before moving to abstract code. Avoid overwhelming students with nested conditions early; start with single IF/ELSE pairs and build complexity gradually. Research shows that students grasp selection best when they see the direct cause-and-effect of their conditions in real time, so live debugging and unplugged activities are critical.
What to Expect
Successful learning looks like students confidently explaining how different conditions trigger specific code blocks and choosing the right structure for given scenarios. They should also justify their logic during peer discussions and debugging sessions.
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 Condition Card Relay, watch for students treating ELSE as optional or skipping it entirely when passing cards down the line.
What to Teach Instead
Pause the relay after two rounds and ask, 'What happens if someone’s condition is false but there’s no ELSE card?' Have them test with a 'no ELSE' scenario to see the program stall or miss actions.
Common MisconceptionDuring Pair Programming: Score Quiz, listen for students arguing that the order of conditions doesn’t matter because 'the computer will figure it out.'
What to Teach Instead
Give pairs two test cases: one where a general condition (e.g., score > 50) is checked first and one where a specific condition (e.g., score == 100) comes first. Ask them to run both and compare outputs to see why order changes the result.
Common MisconceptionDuring Flowchart to Code, notice if students draw linear paths instead of branching ones, treating IF/ELSE like a single sequence.
What to Teach Instead
Have students map a scenario with three outcomes, like a traffic light system, and ask them to draw arrows showing where the flow splits. Point out that each branch must have a clear start and end.
Assessment Ideas
After Condition Card Relay, give students a short code snippet with an IF/ELSE statement. Ask them to write the output for a true condition and a false condition, then swap with a partner to check each other’s work.
During Pair Programming: Score Quiz, pose this prompt: 'Your partner collected 9 coins. What happens in the program if it only checks for 10 coins? How would adding an ELSE statement change this?' Listen for explanations that mention default actions or program behavior.
After Buggy Branches, show two code blocks on the board: one with IF first and one with ELSE first. Ask students to predict which one runs correctly for a given input and explain how order affects the program’s logic.
Extensions & Scaffolding
- Challenge students who finish early to modify their Score Quiz program so it uses at least three ELSE IF conditions to handle multiple score ranges.
- For students who struggle, provide pre-labeled flowchart templates with missing conditions or code snippets to rearrange before writing their own.
- During extra time, have students design a flowchart for a nested IF/ELSE scenario, such as a game with multiple levels and score thresholds, then code it.
Key Vocabulary
| IF statement | A command that checks if a condition is true. If it is, a specific block of code runs. |
| ELSE statement | A command that runs a block of code only if the preceding IF condition is false. It acts as a default path. |
| condition | A statement that can be evaluated as either true or false, used to control the flow of a program. |
| branching | The process of a program taking different paths of execution based on whether a condition is met. |
Suggested Methodologies
More in Variables in Games
Introducing Variables
Learning how to create placeholders for data that changes during a program's execution.
2 methodologies
Changing Variables
Programming triggers that increase or decrease variable values based on user input or sprite collisions.
2 methodologies
Variables for Game Rules
Using variables like timers to create win and loss conditions in a digital game.
2 methodologies
Decisions in Daily Life
Mapping everyday decisions to the logical structures used by computers.
2 methodologies
Sensing and Conditions
Using input sensors like mouse position or color touching to trigger conditional code.
2 methodologies
Ready to teach IF/ELSE Statements?
Generate a full mission with everything you need
Generate a Mission