< Course D (2021)

Lesson 16: Until Loops in Maze

55 minutes

Overview

In this skill-building lesson, students will learn about "until" loops. Students will build programs that have the main character repeat actions "until" they reach their desired stopping point.

Purpose

This set of puzzles will work to solidify and build on the knowledge of loops by adding the until conditional. By pairing these concepts together, students will be able to explore the potential for creating complex and innovative programs.

CSTA K-12 Computer Science Standards (2017)
    • 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.

Agenda

Objectives

Students will be able to:
  • Build programs with the understanding of multiple strategies to implement conditionals.
  • Translate spoken language conditional statements and loops into a program.

Preparation

  • Play through the puzzles to find any potential problem areas for your class.
  • Make sure every student has a reflection journal.

Vocabulary

  • Condition - Something a program checks to see if it is true before allowing an action.
  • Conditionals - Statements that only run under certain conditions.
  • Loop - The action of doing something over and over again.
  • Repeat - To do something again.
  • Until - A command that tells you to do something only up to the point that something becomes true.

Teaching Guide

Warm Up (10 minutes)

Introduction

In this lesson, students will be creating loops that only run "until" a condition is true. Help the students understand how this works by leading them in group activities and having them do an action "until" some condition is true. For example: Have students touch their nose "until" you tell them to stop.

Preview of Online Puzzles

Pull up a puzzle from today's Code Studio puzzles. We recommend Puzzle 4.

  • Ask the class what the bird should repeat to get to the pig.
    • The bird should repeat "move forward", "turn right", "move forward", and then "turn left".
  • Ask the class what they can use to repeat this code.
    • The bird should repeat this pattern until it reaches the pig.

Fill in the rest of the code using the "repeat until" loop and press "Run". Discuss with the class why this worked.

Main Activity (30 minutes)

Until Loops in Maze

Online Puzzles

Bringing together concepts is not easy, but this set of lessons is meant to help students see the endless possibilities of coding when using conditions. If students struggle at all with understanding the similarities or differences between "while" loops and "until" loops, have them try to think of how they would use similar statements in their real lives.

Wrap Up (15 minutes)

Reflection

Prompts:

  • What was today's lesson about?
  • How do you feel about today's lesson?
  • What's the difference between an "until" loop and a "while" loop?
Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.