While and do-while

A while loop evaluates the condition before the loop:

  1. while (!isDone()) {
  2. doSomething();
  3. }

A do-while loop evaluates the condition after the loop:

  1. do {
  2. printLine();
  3. } while (!atEndOfPage());