[Prev: break] [Home] [Next: catch]
switch ( expression ) {
case Value:
Statements;
break;
default:
DefaultStatements;
break;
}
This keyword is used in switch statements. For each possible value that a switch statement's expression may evaluate to, one case may be written, (but see default.) If a case's literal value (Value) matches the value of the switch statement's expression, then that case's statements (Statements) are executed.
Normally a case's statements are terminated by a break statement which causes execution to pass to the end of the switch statement.
See switch for an example.
[Prev: break] [Home] [Next: catch]