← Back to Library
Lesson PlanFreeEN

C5: Loops - Multiple Loops

Students will use multiple loops in a program. They will use Blockly preset programs and Challenge Cards to practice their new skills.

Gr. 2–2
C5: Loops - Multiple Loops

Lesson

Overview

Description

Students will use multiple loops in a program. They will use Blockly preset programs and Challenge Cards to practice their new skills.

Objectives

  • understand how and when to use multiple loops

  • use multiple loops to revise code and complete coding challenges in an iterative process

Before the Lesson

Prior Experience

It is recommended that students complete:

  • Level A-B Lessons: All

  • Level C: Lessons 1-4

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

  • [Optional] Level C Challenge Cards: C 1.1-2.6

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

Loops

Briefly review how students used loops previously by asking:

  • “How were loops used in the Square Dance program?” (Sample response: “Dash created a square dance by repeating drive and turn block moves four times.”)

  • “What is the purpose of loops?” (Sample response: “Loops make our program easier and faster to write.”)

  • “Why are loop blocks in the shape of a C?” (Sample response: “Loop blocks are shaped this way so that we can place the blocks we want repeated inside of them.)

Blockly In-App Puzzle (Optional)

  1. Have students complete the Dash Interrupting Robot puzzle. You can find walkthroughs, solutions, and extensions for the puzzle.

  2. Have students update their Blockly Puzzle Checklists.

  3. Note: If previous puzzles are locked, show students how to quickly unlock them using this strategy: https://help.makewonder.com/customer/en/portal/articles/2318965-how-can-i-reset-challenges-unlock-free-play-or-unlock-wonder-cloud-?b_id=14312

Code.org Connections (Optional)

  1. Review Code.org’s lesson focusing on loops: https://curriculum.code.org/csf/courseb/9/.

  2. After completing the lesson, ask:

    • “Is there a limit to the number of loops we can add to a program? How do you know?” (Sample response: “There is no limit to the number of loops you can add. In this program, we were able to use as many loops as we needed.”)

    • “How would your program have looked if you had not used loops?” (Sample response: “The program would have been much longer if we didn’t use loops.”)

Direct Instruction

Introduction

  1. Say, “Sometimes, you need more than one loop to solve a problem.”

  2. Review real-life examples of problems that would take multiple loops to solve. For example:

    • When playing an instrument, sometimes you repeat different parts of the music at different times. You might repeat the music for each stanza 3 times and repeat the chorus 3 times. This would require 2 different loops.

    • When playing basketball, you use a loop to dribble the ball more than once. Then you use a different loop to shoot the ball through the hoop more than once.

  3. Ask, “When would we want to use more than one loop when we program Dash or Dot?”

    • Sample response: “We’d want more than one loop if we wanted Dash to repeat a light pattern and THEN repeat a different light pattern.”

Quick Check

  • When do you need to use more than one loop in real life? (Sample response: “In music, you need to repeat different parts of the music at different times.”)

  • How could we use more than one loop when programming Dash or Dot? (Sample response: “We could have Dot repeat some sounds and THEN repeat a light pattern.”

Guided Practice

Activity: Dot Light Moves

  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 Dot Light Moves preset program. Then tap “create.”

    Dot light moves
  3. Ask students to look at the program and predict what they think will happen when it is run.

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

  4. Say, “In this program, we are using two loops to repeat different patterns. What are the two patterns that we’re repeating?”

    • Sample response: “We’re repeating a truck horn sound followed by red and yellow lights in one pattern and a dog sound followed by orange and green lights in the other pattern.”

  5. Ask, “What would happen if we changed the number specified on the Repeat block?” (Sample response: “The number of times the code inside the block was repeated would change according to the number specified on the Repeat block.”)

    • Change the number on the Repeat block and have students observe and share what happens.

  6. Ask, “What would happen if we changed the first Repeat block to a Repeat Forever block?” (Sample response: “If we changed the first Repeat block to a Repeat Forever block, then the code inside that block would never stop repeating and we’d never get to the code inside the second Repeat block.”)

    • Change the first Repeat block to a Repeat Forever block and run the program. Have students observe and share what happened.

  7. Ask, “How could we change the Eye Pattern?” (Sample response: “We could change the eye pattern by choosing the Eye Pattern block and tapping the eye lights we want to turn on or off.”)

Quick Check

  • If you wanted to use more than one Repeat block in your code, should the first block be a Repeat block or a Repeat Forever block? Why?” (Sample response: “It should be a Repeat block. If it were a Repeat Forever block, I would never get to the second Repeat block since the Repeat Forever block would repeat until I told it to stop.”)

  • How many Repeat blocks can you use in your code? (Sample response: “You can add as many Repeat blocks as you want.”)

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!

Dot Light Moves Extension

  1. Have students use the Wonder Journal: Dot Planning and/or General Planning worksheet to design ways to add to or alter the Dot Light Moves preset program. They can:

    • Change the eye pattern.

    • Add/change the sounds.

    • Change the light colors.

    • Add animations.

  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 Dot while the code is running.

Challenge Cards

  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:

    • C 3.1: Spaceship Spinout!

    • C 3.2: Help, help, help!

    • C 3.3: Robot Rescue!

  3. For each challenge, encourage students to:

    • Use the Wonder Journal: Dash Planning and/or General Planning worksheet 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 added another Repeat block to our program so that we could repeat a different pattern").

    • Share any obstacles and difficulties they overcame during the activity (e.g., "We weren’t sure how to turn the eye lights on and off, but then we realized that we could turn them on or off by tapping on the shapes around the eye").

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

    • “How did you (add an animation)?”

    • “I like how you (added another Repeat block to the program.)”

Follow-Up Questions/Discussion

  • What would our program look like if we added multiple loops under a When block? (Sample response: “Dot would only perform the loops when they were triggered by the event in the When block.”)

  • How could Repeat blocks help Dot create 2 different light patterns? (Sample response: “When the light blocks were in the Repeat block, the lights would repeat over and over again to make a pattern. We could use 2 Repeatblocks to make 2 different light patterns.”)

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

  • 1A-AP-10: Develop programs with sequences and simple loops, to express ideas or address a problem.

  • 1A-AP-11: Decompose (break down) the steps needed to solve a problem into a precise sequence of instructions.

  • 1A-AP-12: Develop a plan that describes a program’s sequence of events, goals, and expected outcomes.

  • 1A-AP-14: Debug (identify and fix) errors in an algorithm or program that includes sequences and simple loops.

  • 1A-AP-15: Using correct terminology, describe steps taken and choices made during the iterative process of program development.

ISTE

ISTE

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

  • 5a: Formulate problem definitions suited for technology-assisted methods such as data analysis, abstract models and algorithmic thinking in exploring and finding solutions.

  • 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

  • K-2-ETS1-1: Ask questions, make observations, and gather information about a situation people want to change to define a simple problem that can be solved through the development of a new or improved object or tool.

  • K-2-ETS1-2: Develop a simple sketch, drawing, or physical model to illustrate how the shape of an object helps it function as needed to solve a given problem.

Common Core

Common Core

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

  • CCSS.ELA-LITERACY.SL.1.1: Participate in collaborative conversations with diverse partners about grade 1 topics and texts with peers and adults in small and larger groups.

  • CCSS.ELA-LITERACY.SL.1.2: Ask and answer questions about key details in a text read aloud or information presented orally or through other media.

Alberta - Grade 2 - ICT

Grade 2

ICT

C5: Students will use technology to aid collaboration during inquiry.

C6: Students will use technology to investigate and/or solve problems.

F6: Students will demonstrate a basic understanding of the operating skills required in a variety of technologies.

Ontario - Grade 2 - Mathematics

Grade 2

Mathematics: Algebra (Coding)

C3.1 solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves sequential and concurrent events

Nova Scotia

Grade 2

ICT

Outcome 5: Students will be expected to select and use, with teacher support, grade-appropriate digital tools to develop and represent learning for various purposes, both individually and collaboratively. 

Outcome 9: Students will be expected to 

  • use grade-appropriate ICT terminology

  • follow verbal instructions and visual reminders to safely operate computers and digital devices

British Columbia - Grade 2 - ADST

Grade 2

ADST 

• Use trial and error to make changes, solve problems, or incorporate new ideas from self or others 

• Develop their skills and add new ones through play and collaborative work