Skip to content
Computer Science · Grade 10

Active learning ideas

Conditional Statements (If/Else)

Active learning thrives when students manipulate logic in real time, and conditional statements demand just that. Hands-on activities let students wrestle with branching paths, see immediate consequences of their conditions, and transfer abstract concepts into concrete decisions like weather alerts or discount calculations.

Ontario Curriculum ExpectationsCS.HS.A.2CS.HS.P.1
30–45 minPairs → Whole Class4 activities

Activity 01

Escape Room40 min · Pairs

Pair Programming: Weather Advisor

Pairs brainstorm scenarios where weather data triggers advice, like suggesting outfits or activities. They sketch if/else logic with logical operators, code the program in a simple language, and test with varied inputs. Partners switch roles to refine and present one feature.

Analyze how different conditions alter the execution path of a program.

Facilitation TipDuring Pair Programming: Weather Advisor, circulate and listen for students to verbalize their decision logic before coding so they clarify their thinking first.

What to look forPresent students with a short code snippet containing an if/else statement and a specific input value. Ask them to write down what the program will output. For example: 'If age > 18, print "Adult". Else, print "Minor". If age is 15, what is printed?'

RememberApplyAnalyzeRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 02

Escape Room35 min · Small Groups

Small Groups: Flowchart to Code Relay

Groups draw flowcharts for a multi-outcome problem, such as grading quizzes with nested conditionals. One member codes a section while others verify logic. Rotate roles, then run and debug the full program together.

Design a conditional structure to handle multiple possible outcomes.

Facilitation TipDuring Flowchart to Code Relay, assign roles so every student contributes to translating logic, preventing one person from dominating the process.

What to look forGive students a scenario: 'A store offers a 10% discount for purchases over $50, and a 20% discount for purchases over $100. Write an if/else if/else structure to calculate the discount percentage based on the purchase amount.'

RememberApplyAnalyzeRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 03

Escape Room45 min · Small Groups

Debugging Stations: Condition Hunt

Set up stations with buggy code snippets using flawed if/else logic. Small groups visit each, trace execution, fix errors like missing operators, and explain changes on a shared sheet. Regroup to share fixes.

Explain the importance of logical operators in complex conditional expressions.

Facilitation TipDuring Condition Hunt, provide answer keys only after groups justify their answers aloud to reinforce debugging as a reasoning exercise.

What to look forPose the question: 'When might you use the OR operator versus the AND operator in a conditional statement? Provide a real-world programming example for each.' Facilitate a brief class discussion on their responses.

RememberApplyAnalyzeRelationship SkillsSelf-Management
Generate Complete Lesson

Activity 04

Escape Room30 min · Whole Class

Whole Class: Live Code Challenge

Project a base program and poll class for inputs. Students suggest if/else modifications live, vote on logic, and watch execution. Follow with individual tweaks to personalize the code.

Analyze how different conditions alter the execution path of a program.

Facilitation TipDuring Live Code Challenge, limit time per round so students focus on rapid evaluation rather than over-engineering their conditions.

What to look forPresent students with a short code snippet containing an if/else statement and a specific input value. Ask them to write down what the program will output. For example: 'If age > 18, print "Adult". Else, print "Minor". If age is 15, what is printed?'

RememberApplyAnalyzeRelationship SkillsSelf-Management
Generate Complete Lesson

A few notes on teaching this unit

Teach conditionals by starting with physical analogies: traffic lights, vending machines, or door locks. Build from standalone if statements before introducing else, then nested structures. Emphasize that the goal is clarity, not complexity, and avoid teaching exhaustive if-else chains when early returns or switch-like logic would suffice. Research shows students grasp branching faster when they physically walk through paths or use color-coded flowcharts to map outcomes.

By the end of these activities, students will confidently trace, write, and debug if/else structures, nesting conditionals when needed and applying logical operators precisely. They will explain why certain branches execute and justify their design choices to peers with clear reasoning.


Watch Out for These Misconceptions

  • During Pair Programming: Weather Advisor, watch for students to automatically add an else clause even when the problem only requires a single action for one condition.

    Ask pairs to read the problem statement aloud and cross out any else they inserted without a second action, then explain why the single if suffices for the given scenario.

  • During Condition Hunt, watch for students to confuse = and == in the buggy snippets, especially when assignments appear inside conditions.

    Have students circle every assignment in their snippets and replace it with ==, then re-run the imaginary input to watch how the logic changes and the program behaves differently.

  • During Flowchart to Code Relay, watch for students to insist on adding an else branch at every nested level, even when the problem only requires selective actions.

    Challenge groups to remove any else that doesn’t alter program output for the given inputs and justify why the simplified structure still meets the requirements.


Methods used in this brief