D-E > default |
default
default, switch, condition
Availability
Flash Player 6.
Usage
default: statements
Parameters
statements Any statements.
Returns
Nothing.
Description
Keyword; defines the default case for a switch action. The statements execute if the Expression parameter of the switch action doesn't equal (using strict equality) any of the Expression parameters that follow the case keywords for a given switch action.
A switch is not required to have a default case. A default case does not have to be last in the list. Using a default action outisde a switch action is an error and the script doesn't compile.
Example
In the following example, the expression A does not equal the expressions B or D so the statement following the default keyword is run and the trace action is sent to the Output window.
switch ( A ) {
case B:
C;
break;
case D:
E;
break;
default:
trace ("nospecific case was encountered");
}
See also