Iteration

Cards (5)

  • Definite iteration is performed using a for loop.
    • the code inside the loop is repeated for a fixed number of times
    • The number of repeats is controlled using an initial and end value
  • Indefinite iteration is performed using while loops. The code inside the loop is executed repeatedly as long as some condition remains true.
  • Infinite loops are when the program does not exit from the loop because the condition never becomes false.
  • Repeat until loops are indefinite iteration controlled by a condition. Code repeats until condition at the end of the loop becomes true.
  • Nested iteration means putting a loop inside another loop