Learning Portal

Our hands-on, comprehensive lesson plans span a range of levels. Browse our free STEM and coding learning resources.

Marty Image

1.06: What Happens If?

45 Minutes

Lesson Overview

In this lesson, students will continue to develop their understanding and programming skills by looking at a concept called IF statements. Students will be asked to relate IF statements to situations in real life before using them to describe progress in a maze.

Key vocabulary:

If

Then

True

False

Choice

Content Sections

  • Learning Objectives
  • Warm-up:
  • Get Learning:
  • Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
  • Time for Practice
      • Unknown block type "youtube", please specify a serializer for it in the `serializers.types` prop
        • Cool Down:
          • Extensions & Challenges
          • Extend:
          • Support:
          • Additional Reading
          • 1.06: What Happens If?

            45 Minutes

            Lesson Overview

            In this lesson, students will continue to develop their understanding and programming skills by looking at a concept called IF statements. Students will be asked to relate IF statements to situations in real life before using them to describe progress in a maze.

            Key vocabulary:

            If

            Then

            True

            False

            Choice

            • Writing instructions, work with loops
            • Marty the Robot

              Marty Workbook

              Tablets with the Marty the Robot app

            Learning Objectives

            I can explain what I do when I have a choice.

            I can decide what a robot should do when there is a choice.

            Warm-up:

            Share with learners the lesson objectives and success criteria from the presentation. There is a story text that is available to support the idea of choices, and how we and Marty look differently at the idea of choice. The story text is presented with the PowerPoint so that learners can see video and graphics of Marty performing a variety of the tasks but you can choose if you want to just read the text, read the text with the presentation or read the text with a physical Marty performing actions.

            Get Learning:

            Following the story text, tell learners that we are going to sing a song about choices - If You're Happy and you Know it - but before we start singing we need to think about some different feeling words we could use and some actions that can go with them. Instead of starting each verse with 'If you're happy and you know it,' order the feeling words to be used and attach an action to each feeling word.

            Have learners work in groups to rewrite the song with different feelings and potential actions and decide, as a class, which ones you want to sing.

            Sing the first verse, which may actually be if you're happy and you know it, then pause the track after that verse and ask the learners, "How many of you are happy (or the appropriate feeling word), right now?" If there are some who don't say that they are, ask them why they performed the action. They may answer, "Because it is in the song; it tells us to; that's what the words say" or something like that. Tell learners that robots are different. They would only do the action if the feeling were true. If the robot wasn't (feeling word), it wouldn't (action word).

            Let's try the song again with the other feeling words but this time let's be robots. Let's only do the action if we feel that way and not if we don't. This will support the idea that computers, and robots, only carry out instructions that involve conditions that are true.

            The video clip below will play the backing track, there is no need to show the video. It is not essential to play the backing track if you are happy singing without music or you have your own instrument.

            Ask learners what they do when they are given a choice: you are leaving and you have two jackets. One of the jackets will keep you warm and one of the jackets will keep you dry. Which jacket would you choose to wear? Learners should suggest that it depends on the weather: if it is wet, I will wear the one that keeps me dry; if it is cold I will wear the one that keeps me warm.

            Highlight the word IF. Tell learners that, for robots and computers, this word is something that tells us something may happen after a choice is made. The difference is, we can easily figure out what will happen IF we do something, but we need to program machines, and robots, with what will happen when they have an IF statement.

            Time for Practice

            Ask learners for some examples where they don’t even need to think about the consequences, negative or positive, of an action, so they don’t take any time whatsoever choosing what to do:

            • If I brush my teeth
            • If I forget to tie my shoelace
            • If I practice my spelling words
            • If I eat my vegetables
            • there are more in the teacher guide

            Have learners think about what a machine would have to be told, through the if statement, when faced with even a simple choice. Robots need to be told what happens after IF. They need to be told THEN.

            Share with learners the maze that can be used to decide on the result of a condition, this could be printed out or shown from the presentation. Walkthrough the maze for each number:

            • If I see a 1, turn left;
            • If I see a 2, go straight, etc

            As you approach each of the numbers, stop at it and draw an arrow pointing at it to support learners in seeing which direction they need to moving, going forward. This is important in terms of directional language: for 1, you don't go 'up', you turn left; the same is true for 2, you turn 'left' rather than going 'down'; for 3, you go straight; 4 is not necessary for the completion of the maze but is worth exploring because of the direction you face when you approach it. A further support in identifying the correct direction would be to have learners rotate the maze so that the direction of travel is always the same as their point of view when looking at the maze.

            Here is a video of Marty walking a real-life creation of the start of the maze. This is in the presentation.

            Resources are included so that learners can complete their own maze, with the emphasis being on the action after a condition is met. Have learners write if statements at each of the numbers. If a learner is only trying to reach the exit, they don't need to write a statement for each of the numerals but need to include the direction that they take following the numbers they pass on the way to the exit.

            • If I see the number 1 then I need to go straight, turn left / right
            • If I see the number 2...

            Each maze resource has its solution in the teacher guide.

            Cool Down:

            Bring learners back together to discuss the challenges they faced and overcame. Have groups share their instructions for getting through the maze, question, and celebrate different ideas that lead to different places.

            Suggested questions you might ask:

            • Why are the actions necessary after a choice, for computers and robots?
            • Where else might if statements happen in your daily life?

            Carry out any end of lesson routines.

            Log off devices and clear everything away.

            Extensions & Support

            Extend:

            There are two further maze options, one is easier and one is more challenging. In addition, there are samples with no numbers on them. Learners who complete one maze could be given the second maze as a blank maze where they need to find and label places in the maze that require a choice of direction.

            Support:

            There are two further maze options, one is a standard maze, it is less complex, with fewer IF statements to consider.

            Remind learners to rotate the maze or draw arrows as they approach numbers so that their point of view informs which direction they need to take.

            Additional Reading

            Marty the Robot Educator Guide

            • Educator FAQ

            • Technologies: Computing Science
            • Literacy & English: Listening and Talking
            • Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing
            • Literacy & English: Writing
            • CSTA Education Standards
            • Elementary Technology Applications: Grade 3 to Grade 5
            • Digital Technologies, Design & technologies: Design & Technologies
            • Digital Technologies, Design & technologies: Digital Technologies
            • Computing, Design and Technology: Computing
            • International Society for Technology in Education (ISTE)