Loop Control Statements
Loop Control Statements
break statement
The break statement has the following two usages
in C++:
When the break statement is encountered
inside a loop, the loop is immediately terminated
and program control resumes at the next
statement following the loop.
It can be used to terminate a case in the switch.
Flow Diagram:
Example:
The if...else Statement:
Example:
switch statement
A switch statement allows a variable to be
tested for equality against a list of values.
Each value is called a case, and the variable
being switched on is checked for each case.
The following rules apply to a switch statement: