Erin's CS stuff

CS stuff!

Iteration Quick Guide

Type Application Example Notes
do while repeat actions at least once do while
  • the initialization expression can also be the update expression, since the body executes before evaluating the controlling expression
  • the controlling expression comes after the loop body
  • the update expression is inside the loop body
for repeat actions a certain number of times for
  • the initialization, controlling, and update expressions are all part of the loop setup
  • they go in the parentheses before the loop body
while any other circumstances! while
  • the initialization expression is definitely before the controlling expression
  • the controlling expression comes before the loop body
    • this means it is possible that the loop body does not even execute once!
  • the update expression is inside the loop body