Conditional Logic: If/Then StatementsActivities & Teaching Strategies
Active learning works for conditional logic because students must physically or visually step through each branch to see how decisions change program behavior. Moving beyond abstract examples lets learners test predictions in real time, building confidence in how 'if/then' rules control outcomes.
Learning Objectives
- 1Design a simple game or animation using 'if/then' statements to control character actions based on user input.
- 2Predict the output of a given block of code containing 'if/then' statements.
- 3Explain how conditional logic is used in traffic light systems to manage vehicle flow.
- 4Compare the behavior of a program with and without an 'if/then' statement.
Want a complete lesson plan with these objectives? Generate a Mission →
Unplugged: Robot Commands Sort
Print cards with robot actions and conditions like 'if floor wet, then jump'. Students in pairs sort cards into sequences, predict robot paths on a grid mat, then act as robots to test and adjust. Discuss why some paths fail.
Prepare & details
Predict how a program will behave with an 'if/then' statement.
Facilitation Tip: During Robot Commands Sort, ask students to verbalize each decision aloud before placing the command card to reinforce the link between condition and action.
Setup: Flexible space for group stations
Materials: Role cards with goals/resources, Game currency or tokens, Round tracker
Block Coding: Sprite Decision Maze
Using Scratch or similar, students code a sprite to move forward but turn if touching a wall color. Pairs build mazes, swap codes to test, and predict outcomes before running. Refine based on peer feedback.
Prepare & details
Design a program that uses a condition to change its actions.
Facilitation Tip: Before running Sprite Decision Maze, have students sketch the expected path on mini-whiteboards to strengthen prediction and comparison skills.
Setup: Flexible space for group stations
Materials: Role cards with goals/resources, Game currency or tokens, Round tracker
Whole Class: Conditional Story Chain
Teacher starts a story program on the board with an 'if/then'. Class votes on conditions, adds blocks sequentially, and predicts story branches. Run the program to reveal outcomes and vote on revisions.
Prepare & details
Explain the purpose of a conditional statement in everyday life.
Facilitation Tip: In Conditional Story Chain, pause the chain after each conditional turn to ask, 'What would happen if we changed the condition to...?' to build flexibility in thinking.
Setup: Flexible space for group stations
Materials: Role cards with goals/resources, Game currency or tokens, Round tracker
Small Groups: Debug Challenge Relay
Groups receive buggy 'if/then' code printouts for a game. One student fixes a condition per turn, passes to next, predicts full behavior. Test digitally and share fixes with class.
Prepare & details
Predict how a program will behave with an 'if/then' statement.
Facilitation Tip: For Debug Challenge Relay, set a timer so teams feel pressure to articulate each fix before passing the next card.
Setup: Flexible space for group stations
Materials: Role cards with goals/resources, Game currency or tokens, Round tracker
Teaching This Topic
Start with unplugged games so students embody the role of the program. Use consistent color-coding for 'if' (green) and 'else' (red) to build automatic recognition. Avoid rushing to code; let errors surface in the physical or block-based model so students see why order and clarity matter. Research shows that multiple modes—acting, drawing, and coding—strengthen understanding of logic flow.
What to Expect
By the end of these activities, students will confidently trace, write, and explain 'if/then' statements, showing they can predict program flow, debug misplaced conditions, and connect logic to familiar systems like games or traffic lights.
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 Robot Commands Sort, watch for students who place both 'if' and 'else' command cards into the same sequence, assuming both actions always run.
What to Teach Instead
Guide students to physically separate the path into two branches after the condition card, then have a peer walk each path to confirm only one outcome is possible.
Common MisconceptionDuring Debug Challenge Relay, watch for students who rearrange condition blocks without predicting the new outcome first.
What to Teach Instead
Before touching the code, ask each team to write on a sticky note what they expect to happen after the swap, then test and compare predictions to the actual result.
Common MisconceptionDuring Sprite Decision Maze, watch for students who treat conditions as static labels rather than inputs that change during play.
What to Teach Instead
Insert a live demo where you move the sprite by hand while students call out whether the condition is true or false, showing how user input drives the logic.
Assessment Ideas
After Robot Commands Sort, give each student a blank grid with one 'if' condition and have them draw the two possible paths and label which action follows in each case.
During Sprite Decision Maze, show students a 3-block snippet: 'if touching red, say Hello; else, say Goodbye.' Ask them to write one sentence predicting the sprite’s speech, then run the code and circle any differences between prediction and outcome.
After Conditional Story Chain, ask students to name one appliance at home that uses an 'if/then' rule, then share aloud how the appliance behaves differently when the condition changes.
Extensions & Scaffolding
- Challenge early finishers to design a three-level maze with chained conditionals in Scratch that includes a 'reset' button.
- Provide sentence strips with partial conditionals for students who struggle, asking them to match the condition to the correct outcome before building in blocks.
- Deeper exploration: Ask students to research how traffic lights actually use sensors and timers, then write pseudocode that mimics a real intersection’s logic.
Key Vocabulary
| Conditional Statement | A programming statement that performs an action only if a specific condition is true. It allows programs to make decisions. |
| If/Then Statement | A 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. |
| Condition | A test or question within an 'if/then' statement that evaluates to either true or false. For example, 'Is the score greater than 10?' |
| Boolean | A data type that can only have one of two values: true or false. Conditions in 'if/then' statements often result in a boolean value. |
Suggested Methodologies
More in Computational Logic and Repetition
Algorithms and Instructions
Understanding what an algorithm is and how to follow or create a clear set of instructions for a computer.
2 methodologies
Sequences in Programming
Creating simple programs using a sequence of commands to achieve a specific outcome.
2 methodologies
Efficiency Through Loops
Identifying patterns in code and using count-controlled loops to reduce repetition.
2 methodologies
Decomposing Complex Shapes
Using geometry and loops to program a turtle or sprite to draw intricate patterns.
2 methodologies
Debugging Logical Errors
Systematically finding and fixing errors in programs that use repetition and conditions.
2 methodologies
Ready to teach Conditional Logic: If/Then Statements?
Generate a full mission with everything you need
Generate a Mission