Overview

Definite (for) loops are great when you know exactly how many times you want to iterate. But there are situations where you just don’t know how long the loop should run, like when you are relying on input from the user to tell you they are done with something. Indefinite iteration solves this problem and will be today’s focus.

Basic Learning Objectives

Before class, you should be able to:

  • Write a basic indefinite loop using while
  • Identify what break and continue do
  • Give an example of a situation where you should use an indefinite loop
  • Explain what an infinite loop is

Advanced Learning Objectives

After class, you should be able to:

  • Write an indefinite loop to solve several types of problems
  • Debug an infinite loop
  • Identify when an indefinite loop should be used instead of a definite loop

Resources

You should read/watch the following and complete the embedded checks: