Control Structures
Sequential structures
Statements will be executed in the order they're written.
Selection structures
Single-selection structure
The if structure is a single-selection
structure because it selects or ignores a single action.
Double-selection structure
The if/else structure is called
a double-selection structure, because it selects between two different
actions.
Multiple-selection structure
The switch structure is called a
multiple-selection structure, because it selects one of many possible
actions. (to be discussed later)
Repetition structures
- The while loop has a condition that
is tested before the loop is entered. The loop will continue to execute as
long as that condition is true.
- The do/while loop always executes once,
since the condition is given at the end of the loop. The loop will execute
again if the condition is true. (to be discussed later)
- The for loop executes a specified number
of times.
(to be discussed later)