Today, your students will apply their knowledge of If/Then/Else statements in a fun, unplugged way by creating a choose-your-own-adventure mystery story. Explain to the class that every time the reader makes a choice, they are creating a new path in the story, just like a programmer creates a new path for their code. These paths will lead to different outcomes and endings.
The key to this lesson is the conditional logic:
If the reader chooses to do something...
Then a specific outcome will happen...
Else, if they choose something else, a different outcome will occur.
For example, a story might have a line like, "If you open the door, then you find a clue; else, you get lost." By the end of the lesson, your students will have created a full, branching story powered by their own conditional logic.
To make sure everyone is on the same page, ask for a few real-life examples. You can start with our break time planner from a previous lesson:
If it's raining, then we'll stay indoors for quiet games.
Else (or otherwise), we'll go outside to the playground.
Invite 3โ4 pupils to share their own examples. As they do, note them on the board, pointing out the if and the then/else parts of their sentences. This review will set a strong foundation for today's creative challenge.
Now that you've reviewed the basics, you're ready to put your knowledge of conditionals to the ultimate test. Explain that a choose-your-own-adventure story is a special kind of story where the reader is in control. Their choices determine what happens next, creating a different path and a unique ending every time.
In a way, they're acting as the program's conditional logic, with each choice being an if statement that leads to a different then outcome.
Before they create their own stories, you can let them try out a simple, ready-made virtual adventure to see how it works. This will give them a perfect example of how the story can branch off in different directions based on a single choice.
Now it's time to brainstorm your very own mystery stories. This is the fun part, where you get to be both the author and the programmer!
Have your pupils pair up and give them three minutes to come up with a simple mystery idea. You can offer a few examples to get their imaginations going, such as 'The Case of the Missing Diamond' or 'The Secret Cave.'
Explain that they need at least two choice points in their story, where the reader's decision leads to a different path. This is just like an if/then/else statement in code.
For example, "If you follow the footprints, then you find a clue; else, you get lost."
Remind them to keep it simple, aiming for no more than 4-5 parts total, including the final endings.
Now that your students have their story ideas, it's time to create a flowchartโtheir story's blueprint. Explain that a flowchart is like a map that helps a programmer see every step and every possible choice in a program. It's a key part of planning before you start writing.
Instruct each pupil to draw a flowchart of their mystery story on a piece of paper. They should start with a box for the beginning, then draw branches for each choice they brainstormed. The if/then/else flow should be clear: a box for a choice should have arrows pointing to each possible outcome, just like the model you showed on the board.
Give them about 10 minutes to complete this. Remind them that using arrows and boxes to show the path of their story is how they'll visually represent their if/then/else logic.