Control statements are statements that alter the sequence of flow of instructions.
Types of control statements:
1. Selection statement: The selection statement means the statement (s) executed, depends upon a condition. If a condition is true, a true block (a set of statements) is executed otherwise a false block is executed. This statement is also called decision statement or selection statement because it helps in making decision about which set of statements are to be executed.
Example:
1. If
2. Switch
2. Iteration (or looping) statement:
An iteration (or loop) is a sequence of one or more statements that are repeatedly executed until a condition is satisfied. These statements are also called as control flow statements. It is used to reduce the length of code to reduce the time to execute program and takes less memory space.
Example:
1. While
2. do ….. while
3. for