(Francais) D1: Loops - Nested Loops
Description Level D, Lesson 1: Students will learn how and why to use Nested Loops. They will use Blockly preset programs and Challenge Cards to practice their new skills. Objectives Understand the de

Educational Standards
CSTA
ISTE
NGSS
Common Core
Wrap Up
Student Presentations
- 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 loop to the program because we thought it would make it more interesting.” "We used the Repeat block/s in order to make our code shorter.”).
- Share any obstacles and difficulties they overcame during the activity (e.g., "At first, we didn't know how to make a custom eye pattern for Dot, but then we tapped the Eye Pattern block and tapped the lights around the circle.”).
- 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 (create that Eye Pattern)?"
- "I like how you (added lights and sounds to your program)."
- "What if you (used a Repeat Forever block)?"
Follow-Up Questions/Discussion
Nested Loops are used when a larger process is broken down into smaller pieces. These processes in everyday life are similar to Nested Loops in code:
- You perform a loop by going to school every day. As part of the school day, you have lunch and perform a loop to eat your food by taking a bite food, chewing, and then swallowing. That eating loop is nested inside the going to school loop.
- Can you think of a time in your life when you use a process similar to Nested Loops?
Assessment
- Use our Evaluation Rubric to review students' work and presentations.
- [Optional] Share your students' work with the world using @logicsacademy and #dashanddot!
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!
Fight The Fire Extension
- Have students use the Wonder Journal: Dot Planning and/or General Planning worksheet to to discuss how they want to add or alter the Fight the Fire preset program. They can:
- Change the cues that are used.
- Change the sounds and/or animations.
- Add lights or sounds.
- 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 (Optional)
- You can purchase our Learn to Code Challenge Card sets and Curriculum Guide here: https://logicsacademy.com/store/
- Have students complete the following Challenge Cards:
- D 1.1: Cheer Up, Friends!
- D 1.2: Step It Up!
- D 1.3: Happy Dance Flash Mob
- 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 worksheets if they run into any problems with their code.
- 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.
Guided Practice
Activity: Fighting The Fire
- Say, "We just looked at a program that uses nested loops." Point to the nested loop that is used in this program.
- Then say, "Why do we say that it's 'nested'?" (Sample response: “We say it’s nested because it is inside of another repeat block, just like birds are inside of a nest.”)
- Say, "Look at the program and predict what will happen when we run it with Dot." (Sample response: "Dot will make a fire engine noise and then go through all the light patterns two times. Then the entire process will repeat 5 times.")
- Run the program and see if the student predictions were correct.
- Ask: "What would happen if we changed the number in either repeat block?"
- "What would happen if we used a Repeat Forever block?"
- "How could we nest an additional repeat block in the program?" (Sample response: "We could add a new repeat block inside the first repeat block. The new repeat block could repeat some sounds.")
- "Where would we have to place the repeat block in order for it to be considered nested?" (Sample response: "The repeat block would have to be placed inside another repeat block.")
Instruction
Introduction
- Say, "Think of a bird's nest and what it looks like." Draw a picture of a bird's nest on the board or smartboard. "Now think of how a bird fits inside the nest." Add birds to the nest.
- Have students choose partners. Ask, "What do you think a "nested loop" looks like using block coding?"
- Have partners discuss and draw a prediction of what they think a nested loop looks like (on paper or a tablet screen).
- Project your tablet screen and open the Blockly app.
- Go to the Create New Project menu and select the Fight the Fire preset program. Then tap “create.”

- Have students compare their nested loop prediction illustrations to the nested loop in the Fight the Fire preset program.
- Then ask student pairs to write their own definition of a nested loop. (Sample Response: "Nested Loops are loops that are found inside another loop.")
Quick Check
- What do nested loops look like? (Sample response: "A nested loop is one loop with one or more loops placed inside it.")
Review
Loops Review
Briefly review loops with the students by asking:
- "What are loops?" (Sample response: "Loops are bits of code that repeat.")
- "Why do we use loops in coding?" (Sample response: "Loops allow us to repeat code over and over, as many times as we need, in a very simple way.")
Code.Org Connections [Optional]
Review Code.org's Course D, Lesson 4: https://curriculum.code.org/csf/coursed/4/. Then ask:
- How do nested loops work? (Sample response: "You place one or more repeat loops inside another repeatloop.")
Before the Lesson
Prior Experience
It is recommended that students complete:
- Level A-C: Lessons 1-6
- [Optional] Level A-C 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.
