Lesson 1: If/Then Thinking
Estimated time: 15-20 minutes | Screen-Free Activity
What You Will Learn
By the end of this lesson, your child will be able to:
- Explain what an if/then rule is
- Give examples of if/then rules from everyday life
- Create their own if/then rules for different situations
Decisions Are Everywhere
Every single day, you make decisions. Some are small: "Should I wear the red shirt or the blue shirt?" Some are bigger: "Should I bring an umbrella to school?" You might not even notice you are making decisions because your brain does it so fast.
But here is something cool: almost every decision follows a simple pattern. It goes like this:
If/Then Rule -- A rule that says: "IF something is true, THEN do something." It has two parts: a condition (the "if" part that you check) and an action (the "then" part that you do).
You already use if/then rules all the time, even if you do not say the words "if" and "then" out loud!
If/Then Rules in Daily Life
Here are some if/then rules you probably follow every day:
Notice the pattern: first you check something (is it raining? am I hungry? is the light red?), and then you do something based on the answer. The "if" part is what you check. The "then" part is what you do.
Talk About It
Read each if/then rule above with your child. Then ask: "What are some if/then rules that you follow?" Help them think of rules from school, home, or playing outside. Every rule they come up with shows they understand the pattern!
What Happens When the "If" Is Not True?
Sometimes the "if" part is not true. If it is NOT raining, do you still take an umbrella? Probably not! When the condition is not true, you do something different -- or nothing at all.
This gives us an even more powerful rule: if/then/else.
If/Then/Else -- "IF something is true, THEN do this. ELSE (otherwise), do that instead." This lets you handle both possibilities.
Think of It Like a Fork in the Road
Imagine you are walking and you come to a fork where the path splits in two. You have to choose: go left or go right. An if/then/else rule is like that fork. You check the condition, and based on the answer, you take one path or the other.
Why Computers Need If/Then Rules
Computers use if/then rules all the time. In fact, without if/then rules, computers could only do the same thing every time -- they could never make choices!
- Video games: "If the player jumps, then move the character up. If the player touches an enemy, then lose a life."
- Weather apps: "If the temperature is below freezing, then show a snowflake icon."
- Alarm clocks: "If the time is 7:00 AM, then play the alarm sound."
- Websites: "If the password is correct, then let the person in. Else, show an error message."
Every app, game, and website you have ever used is full of if/then rules. Hundreds or even thousands of them! In Lesson 4, you will use if/then rules in Scratch to make your own programs respond to what the user does.
Activity: The "What Would You Do?" Game
Screen-Free Activity (10 minutes)
How to play: Take turns describing a situation. The other person has to make an if/then rule for it.
Example situations:
- "You wake up and look outside. The ground is covered in snow." (If it is snowy, then wear boots and a warm coat.)
- "You open your lunchbox and your sandwich is missing." (If my sandwich is gone, then ask a teacher for help.)
- "A friend invites you to play, but you have not finished your homework." (If homework is not done, then finish it first. Else, go play!)
- "You are at the park and you hear thunder." (If you hear thunder, then go inside.)
- "Your favorite show is on, but it is time for dinner." (If it is dinnertime, then eat dinner first.)
Make up your own! Take turns being the one who describes the situation and the one who makes the rule. Try to use the words "if" and "then" every time.
Bonus challenge: Can you add an "else" to your rules? That means you handle both possibilities!
Make Your Own If/Then Rule Book
Optional Extension Activity
Fold a piece of paper in half to make a little book. On each page, write one if/then rule and draw a picture to go with it. Here are some ideas to fill your book:
- Rules for school (If the bell rings, then...)
- Rules for being a good friend (If a friend is sad, then...)
- Rules for a pet (If the dog is barking, then...)
- Rules for a superhero (If a villain appears, then...)
- Silly rules (If a dinosaur walks into the kitchen, then...)
The sillier the rules, the more fun this is! And silly or serious, every rule still follows the if/then pattern.
Check Your Understanding
1. What are the two parts of an if/then rule?
2. What does "else" mean in an if/then/else rule?
3. Can you make an if/then rule for this situation: "You find a lost dog in your yard"?
Key Takeaways
- An if/then rule has two parts: a condition to check and an action to do
- You use if/then rules every day without even realizing it
- If/then/else handles both possibilities -- what to do when the condition is true AND when it is not
- Computers use if/then rules to make decisions in games, apps, and websites
- Without if/then rules, computers could never make choices
Ready for More?
Next Lesson
In Lesson 2, you will learn about yes/no questions -- the building blocks of all decisions. Plus, you will play 20 Questions!
Start Lesson 2Module Progress
You have completed Lesson 1! Three more lessons to go in Module 4.