controls the loops. The while statement tests the relation at the top of the loop, and
the do...while statement tests the relation at the bottom of the loop, forcing all its
statements to execute at least once. Key concepts covered in this chapter include:
- Use while or do...while when you need to repeat a section of code.
- Make sure that the body of the while or do...while loop changes something in
the condition, or the loop will repeat forever. - Remember that loops differ from if because the body of an if executes only once
instead of many times if the condition is true. - Don’t put a semicolon after the while condition’s closing parenthesis. If you
do, an infinite loop will occur.