A control statement is a statement that determines whether other statements
will be executed.
- An if statement decides whether to execute
another statement, or decides which of two statements to execute.
- A loop decides how many times to execute another
statement. There are three kinds of loops:
- while loops test whether a condition
is true before executing the controlled statement.
- do-while loops test whether a condition
is true after executing the controlled statement.
- for loops are (typically) used to execute
the controlled statement a given number of times.
- A switch statement decides which of
several statements to execute.