Session 2: Conditionals Quest
Session Architect: Muhammad Bilal
Duration: 50-60 minutes
Equipment Required:
- M3D Robotics kit.
- Laptops with Scratch pre-installed.
- Paper and pencils for students to plan and solve math problems.
- Printed activity sheets with math questions.
Learning Objectives:
- Understand the concept of conditional logic using If-Then and If-Then-Else blocks in Scratch.
- Learn how to make the robot perform different actions based on specific conditions.
- Apply problem-solving skills by creating condition-based tasks for the robot, linking logical thinking to real-world decision-making.
- Develop an understanding of how conditions can work to create responsive actions in coding.
- Gain confidence in coding by designing a robot math teacher that can check answers and provide feedback based on conditions.
Resources:
Scratch Code for the session:
Grade 4 Session 2.sb3 (3.4 MB)
1. Introduction to Conditional Logic (5 minutes)
Activity:
Start with an engaging and relatable introduction to the idea of conditions, using fun examples from the students’ daily lives.
Instructions:
You might start by saying:
“Have you ever had to make a choice depending on what happens around you? Like, if it’s sunny, you might go outside to play, but if it’s raining, you might stay inside and watch your favorite show. These are conditions that help you decide what to do!”
- Encourage students to think of more examples from their daily routines. You can ask:
“What happens if it’s your friend’s birthday? Maybe you give them a gift, but if it’s not, you don’t, right? This is like a robot deciding what to do based on a rule!”
Explain that just like they make decisions based on certain conditions, we can make the robot decide what to do based on certain rules using coding blocks.
2. Exploring the If-Then and If-Then-Else Blocks (10 minutes)
Activity:
Introduce the If-Then and If-Then-Else blocks in Scratch and demonstrate how they work with simple examples.
Instructions:
- Open Scratch and show the students the If-Then block and explain how it works:
“This block works like a question. It asks if something is true, and if it is, the robot will do what’s inside the block. If not, it won’t do anything. It looks like:”
An example of the use of this block could be:
This code block checks if the robot is connected to the laptop. If it is, it displays the message “Hello!” on the screen.
- Then introduce the If-Then-Else block and explain:
“This block is a little different. It asks a question too, but if the answer is ‘yes,’ the robot will do one thing. If the answer is ‘no,’ it will do something else.”
An example of this could be:
This code block checks if the sum is correct or not. If it is, it will smile and start spinning. If it is not, it will show a “frustrated” face on the screen.
It is suggested that you create this code in front of them on a projector screen so that they don’t get overwhelmed when they see a conditional block with other blocks paired up for the first time.
You may say:
“Let’s think of this like making a choice. Imagine if you had a magic robot teacher that would check your answers for you. If you’re right, it smiles! If you’re wrong, it looks confused. That’s exactly what we’re going to create today. But first, let’s practice with the basics.”
Encourage students to explore different conditions blocks which can fit in the If-Then Block:
The understanding of their function is not the aim here. Students should just able to identify condition blocks and play around and see how the blocks snap into one another.
3. Simple Condition-Based Robot Tasks (15 minutes)
Activity:
Students will start with simple condition-based tasks using If-Then blocks and If-Then-Else blocks. They will learn about conditional logic and how it helps the robot respond to different situations.
Instructions:
Give students small challenges to practice:
- For example, you may start with asking the students to recreate the conditional code that you just showed on the projector screen:
“If the robot is connected to the laptop, it displays the message “Hello!” on the screen.”
- Once that is done, you can move to further tasks such as:
“If the sum is correct, it will smile and start spinning. If it is not, it will show a “frustrated” face on the screen.”
- Encourage them to experiment with different conditions, movements and expressions.
Teacher’s Role:
Move around the room, assisting students with their code, answering questions, and helping them understand how to use movement blocks and conditions with if-then and if-then-else blocks.
4. Creating a Robot Math Teacher (20 minutes)
Activity:
Students will code their robot to act as a math teacher that checks addition, subtraction, multiplication, or division questions and tells them if their answer is correct or not.
Instructions:
-
Start by asking the students to think of a math question, like “What is 3 + 2?”
-
Students will then code the robot to check their answer using If-Then-Else blocks:
- “If the answer is correct, the robot will show a happy face.”
- “If the answer is wrong, it will show a confused face.”
-
Explain the steps they need to take:
- Set up a math question (e.g., 3 + 2).
- Use an If-Then-Else block to check if the student’s answer matches the correct answer. Help them understand how can use If-then block to check the answer that they enter.
- Display the appropriate emoji based on whether the answer is right or wrong.
The final code should look like this:
The students can use the green block on the right to input numbers and then drag and drop it on the left side of the conditional block.
If they answer is correct, the robot will smile, else it will be confused.
- Let students test their code:
“Let’s see if your robot can act like a teacher! Try asking it a math question, and see if it can check your answer.”
Assist them if their code is giving wrong results or if the condition that they have coded is wrong.
5. Reflection and Wrap-Up (5-10 minutes)
Activity:
Conclude the session by reviewing what the students learned about condition blocks and how they used them to make decisions.
Reflection Questions:
- “What was the most fun part about making your robot a math teacher?”
- “Why do you think conditions are important in coding?”
- “What else do you think you could ask the robot to decide using conditions?”
Teacher’s Role:
Celebrate the students’ efforts and successes, highlighting how they’ve used conditions to make their robots smart and responsive.
Learning Outcome:
By the end of the session, students will have a basic understanding of condition blocks like If-Then and If-Then-Else. They will have applied these concepts in fun, practical tasks, creating condition-based logic for their robot and learning how to check answers in a simple math quiz using their code.






