Execution of the
switch
Statement
- The selector expression is evaluated; the result will be some integral value.
- The labels are searched in the order they appear in the code.
The first occurrence of the selector's value is the
case that is selected.
- Statements following this
case
label are executed in the order they appear.
- Statements are executed until a
break
statement is reached.
- When a
break
statement is reached, control is transferred to the first statement that follows the entire
switch statement .
Previous page
Next page
Back to Lesson 8 Index
Back to Outline