Section outline

    • Micro-Topic 8.1: For Loops (Definite Iteration)
      Goal: Use
      for loops to repeat actions a specific number of times or over each item in a sequence, understanding the role of the loop variable.

    • Micro-Topic 8.2: While Loops (Indefinite Iteration)
      Goal: Understand how to use
      while loops to repeat an action as long as a certain condition remains true, and be aware of the risk of infinite loops.

    • Micro-Topic 8.3: Loop Control: Break and Continue
      Goal: Learn how to prematurely exit a loop with
      break or skip to the next iteration with continue, and understand when these are useful.

    • Micro-Topic 8.4: Loop Design and Avoiding Infinite Loops
      Goal: Learn best practices for designing loops (especially while loops) so that they terminate properly, and understand how to avoid or handle infinite loops.