← Back to Library
Lesson PlanFreeEN

F1: Conditionals - Nested Conditionals

Students understand how to identify and use nested conditionals. They will use Blockly preset programs and Challenge Cards to practice their new skills.

Gr. 5–5
F1: Conditionals - Nested Conditionals

Lesson

Overview

Description

Students understand how to identify and use nested conditionals. They will use Blockly preset programs and Challenge Cards to practice their new skills.

Objectives

  • identify a nested conditional

  • use and manipulate a nested conditional effectively

  • use nested conditionals to revise code

  • complete coding challenges in an iterative process

Before the Lesson

Prior Experience

It is recommended that students complete:

  • Levels A-E Lessons: All

  • [Optional] Level A-E Challenge Cards: All

You can purchase our Learn to Code Challenge Card sets and Curriculum Guide here: https://store.makewonder.com/#/education

Preparation

  • Fully charge the tablets and robots.

  • Install the Wonder Workshop Blockly app on each tablet.

Review

Conditionals

  1. Ask, “What is a conditional?"

    • Sample response: “A conditional is a piece of code that allows a program to make decisions.”

  2. Say, “In the past, you have learned about nested loops. What is a nested loop?”

    • Sample response: “A nested loop is when one or more loops are placed inside another loop.”

  3. Say, “Knowing what you know about nested loops, what do you think a nested conditional is?”

    • Sample response: “A nested conditional is when one or more conditionals are placed inside each other.”

Code.Org Connections (Optional)

  1. Review Code.org’s lesson focusing on if/else conditionals: https://studio.code.org/s/coursee-draft/stage/3/puzzle/5.

  2. Then ask: “How were the If/Else blocks used in these puzzles?”

    • Sample response: “An If/Else block was used to pick the vegetables on the farm. If there was corn, the farmer picked it. If there was something else, the farmer picked lettuce.”

Direct Instruction

Introduction

  1. Say, “Dash is stuck! Dash needs our help.We are going to use nested conditionals to help Dash! Nested conditionals have one or more conditionals inside another conditional. The conditionals are nested, just like nested loops.”

  2. What is a real-life example of a nested conditional?

    • Sample response: “When you are running in a race, if you hear, ‘Ready, Set, Go!' then you run, else you wait. Once the race begins, you continue running but then check for another conditional: If you cross the finish line, then you stop running.”

Quick Check

  • What are some types of conditional blocks? (Sample response: “A conditional might be an If or If/Else block.”)

  • What do nested conditionals look like, and how do they act? (Sample response: “Nested conditionals have one or more loops inside other loops. Nested loops repeat behaviors inside the loops the number of times that is set by the conditional surrounding them.”)

Guided Practice

Activity: Break Out

  1. Project your tablet screen, open the Blockly app, and go to the menu at the top left of the screen.

  2. Go to the Create New Project menu and select the Break Out preset program. Then tap “create.”

    Break Out
  3. Ask, “What does the word nested mean in coding?” (Sample response: “Nested means a bit of code is placed in the middle of another bit of code.”)

    • Say, “A nested conditional is when one or more conditionals are placed inside another conditional statement.”

  4. Ask the students to look at the program and predict what they think will happen when it is run.

    • Run the program to see if the students’ predictions were correct.

  5. Draw the flowchart below (without the text shown in white) on the board and have students fill in the empty boxes.

flowchart

6. Say, “Dash needs to check something for each conditional. How many times does Dash need to check for something?”

  • Sample response: “Two different checks: whether an Obstacle is In Front and whether an Object is Behind.

7. ”Ask, “What decision does Dash make after the first check?”

  • Sample response: “If there’s an Obstacle in Front, then Dash will say ‘Uh Oh!’”

8. Ask, “Which checks need to happen before Dash turns left 90 degrees?

  • Sample response: “Dash needs to check for an Obstacle in Front and THEN check for an Object from Behind.”

9. Ask, “What are some things you could change in this program?” (Sample response: “You could change the cues for Dash, add a conditional, and add lights and sounds.)

Quick Check

  • Could you have nested more conditional statements in your program? (Sample response: “Yes, there are an unlimited number of conditionals that you could nest, but it gets pretty confusing after three.”)

  • What is the purpose of nesting conditionals? (Sample response: “When you nest conditionals, it allows the program to check for more than one thing.”)

Independent Practice

Instructions

Have students work on the following activities in small groups (ideally 2-3 students per robot).

Encourage students to share tablet and robot time. Have them establish and rotate through roles such as:

  • Lead Programmer: Holds the tablet and manipulates the code.

  • Robot Wrangler: Retrieves and resets the robot after every program attempt.

  • Documentarian: Records group results, thoughts, and progress. Illustrates group designs and ideas.

When students work together while coding, they're able to help each other identify mistakes and develop creative solutions!

Break Out Extension

  1. Have students use the Wonder Journal: Dot Planning or General Planning worksheet to design ways to add to or alter the Break Out preset program. They can:

    • Change the If/Else block

    • Add lights and sounds.

    • Change how much the variable increases or decreases.

    • Change the cue.

  2. After they finish revising the program, have students:

    • Complete a Wonder Journal: Reflection worksheet.

    • Take a screenshot of their Blockly code.

    • Take a video of Dash while the code is running.

Challenge Cards (Optional)

  1. You can purchase our Learn to Code Challenge Card sets and Curriculum Guide here: https://logicsacademy.com/store/

  2. Have students complete the following Challenge Cards:

    • F 1.1: Dash-chund

    • F 1.2: Ruff, ruff!

    • F 1.3: Nom, nom, nom!

  3. For each challenge, encourage students to:

    • Use the Wonder Journal: Dash Planning or General Planning worksheets to discuss how they can complete the challenge.

    • Review the Troubleshooting and Problem Solving & Debugging worksheet if they run into any problems with their code.

  4. After they finish each challenge, have students:

    • Complete a Wonder Journal: Reflection worksheet.

    • Take a screenshot of their Blockly code.

    • Take a video of Dash while the code is running.

    • Update their Challenge Card Checklists.

Wrap Up

Student Presentations

  1. Have student groups take turns sharing one of their programs with the class. Encourage them to:

    • Explain their design thinking (e.g., “We wanted to add (another nested conditional) because . . . ,” “We changed the (animations) because . . .”).

    • Share any obstacles and difficulties they overcame during the activity (e.g., “We wanted to add another conditional, but we weren’t sure where to put it”).

  2. Encourage students to ask each other how they accomplished different objectives and give each other feedback on their programs. Possible questions/feedback includes:

    • “Why did you (add another Repeat block)?”

    • “I like how you (added another If/Else block).”

    • “What if you (added an If statement in the Else block)?”

Follow-Up Questions/Discussion

  • How did you get Dash to check for multiple things in this program? (Sample response: “We used nested conditional blocks”).

  • Why are nested conditionals important? (“Nested conditionals allow our program to check for multiple things before making a decision. It helps Dash make more complicated decisions!”)

Assessment

  • Use our Evaluation Rubric to review students’ work and presentations.

  • [Optional] Share your students’ work with the world using @logicsacademy and #dashanddot!

Educational Standards

CSTA

CSTA

  • 1B-AP-10: Create programs that include sequences, events, loops, and conditionals.

  • 1B-AP-11: Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.

  • 1B-AP-12: Modify, remix, or incorporate portions of an existing program into one’s own work, to develop something new or add more advanced features.

  • 1B-AP-15: Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intended

  • 1B-AP-16: Take on varying roles, with teacher guidance, when collaborating with peers during the design, implementation, and review of program development.

  • 1B-AP-17: Describe choices made during program development using code comments, presentations, and demonstrations.

  • 2-AP-12: Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.

ISTE

ISTE

  • 4d: Exhibit a tolerance for ambiguity, perseverance and the capacity to work with open-ended problems.

  • 6b: Create original works or responsibly repurpose or remix digital resources into new creations.

  • 7c: Contribute constructively to project teams, assuming various roles and responsibilities to work effectively toward a common goal.

NGSS

NGSS

  • 3-5-ETS1-2: At whatever stage, communicating with peers about proposed solutions is an important part of the design process, and shared ideas can lead to improved designs.

Common Core

Common Core

  • CCSS.ELA-LITERACY.W.2.6: With guidance and support from adults, use a variety of digital tools to produce and publish writing, including in collaboration with peers.

  • CCSS.ELA-LITERACY.W.2.8: Recall information from experiences or gather information from provided sources to answer a question.

  • CCSS.ELA-LITERACY.SL.3.1: Engage effectively in a range of collaborative discussions (one-on-one, in groups, and teacher-led) with diverse partners on grade 3 topics and texts, building on others' ideas and expressing their own clearly.

  • CCSS.ELA-LITERACY.SL.3.3: Ask and answer questions about information from a speaker, offering appropriate elaboration and detail.

  • CCSS.ELA-LITERACY.SL.3.4: Report on a topic or text, tell a story, or recount an experience with appropriate facts and relevant, descriptive details, speaking clearly at an understandable pace.

Alberta - Grade 5 - CTF

Grade 5

CTF

Planning, creating, appraising and communicating in response to challenges. 

Working independently and with others while exploring careers and technology

Ontario - Grade 5 - Mathematics

Grade 5

Mathematics: Algebra (Coding)

C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves conditional statements and other control structures.

Nova Scotia - Grade 5 - ICT

Grade 5

ICT

P2: Students will be expected to use digital tools to develop ideas and original works in innovative ways.

TOC1: Students will be expected to 

  • safely use many forms of current technology for learning with growing competence 

  • demonstrate conceptual understanding of how information and communication technology, digital tools, and authorized networks support their learning 

  • use terminology related to information and communication technology

British Columbia - Grade 5 - ADST

Grade 5

ADST

• Make changes and test again, repeating until satisfied with the product 

• Use materials, tools, and technologies in a safe manner, and with an awareness of the safety of others, in both physical and digital environments 

• Identify the skills required for a task and develop those skills as needed 

• Use familiar tools and technologies to extend their capabilities when completing a task 

• Demonstrate a willingness to learn new technologies as needed