Chapter 16

Loops

Learning Objectives

Upon completing all the content in this chapter, you should be able to do the following:

  1. Use loops: for and while.
  2. Modify the flow of control in loops using break and continue.
  3. Explain the difference between break and continue.

Key Terminology

Here is a list of key terms for this chapter, broken down by the page upon which the term first appears. Make note of these terms and the definitions as you read through this chapter.

Iteration

  1. iteration
  2. DRY
  3. zero-based indexing

For Loops

  1. for loops
  2. definite iteration
  3. loop variable
  4. zero-based indexing

More on Range

  1. start value
  2. stop value
  3. step value

While Loops

  1. while loop
  2. input validation
  3. indefinite iteration

Infinite Loops

  1. infinite loop

Ending Loops with a Break

  1. break
  2. continue