Overview

Students practice the basics of loops including using while loops, repeat times loops, and updating multiple screen elements with a while loop. Along the way students develop debugging practices with loops.

Goals

Students will be able to:

Purpose

This lesson is students primary opportunity to get hands on with loops in code prior to the Make activity in the following lesson. Give students as much class time as you can to work through these. For this lesson it's recommended that you place students in pairs as a support and to encourage discussion about the challenges or concepts they're seeing.

Getting Started (5 mins)

Remarks


Teaching Tip

Move Quickly to the Activity: There's a lot in the main activity of today's lesson. You may optionally wish to do a quick vocabulary review or address any questions that came up in the last lesson. Otherwise, give students more time to get hands on with some code.


Activity (35 mins)

Remarks

Open a Project: For today's activity, students will work through a series of projects, beginning with Lesson7_App1.

Teaching Tip

Providing Support: Circulate around the room through the lesson encouraging students to use the strategies introduced at the beginning of the lesson. Students have a number of supports at their fingertips, so a big part of your role is helping build their independence in using those resources.


Apps 1-3 While Loop Practice: Simple output projects in which students practice using while loops.

Apps 4-6 Repeat Times Loop Practice: In these levels, students consider when to use repeat times loops, and when they should use repeat while loops instead.

Apps 7-8: Loops and Screen Elements: In these levels students practice writing programs that modify screen elements with loops. Screen elements have already been designed to have repeated patterns (e.g. "dice0", "dice1", "dice2" ...) that make it possible to write code that modifies every screen element. This is important practice for the Make project in the next lesson.

Wrap Up (5 mins)

Prompt: What aspects of working with loops do you feel like clicked today? What do you still feel like you have trouble with?

Discuss: Have students share with one another before sharing with the whole class.

Discussion Goal

Use this opportunity to address any lingering questions or misconceptions in the room. You can also use this as a source of discussion topics to kick off the following lesson. As you lead the discussion, call out the many resources students have access to help when they're getting stuck.


Remarks

Assessment: Check for Understanding: AP Practice

Question: What will be displayed after this code segment is run?

a <- 0
REPEAT 3 TIMES
{
    a <- a + 1
    DISPLAY(a)
    a <- a + 1
}

Question: What will be displayed after this code segment is run?

count <- 0
REPEAT UNTIL (count = 3)
{
    count <- count + 1
    DISPLAY("and")
    DISPLAY(count)
}

Standards Alignment