default

Availability

Flash Player 6.

Usage

default: statements

Parameters

statements Any statements.

Returns

Nothing.

Description

Statement; 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 outside 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 panel.

switch ( A ) {
  case B:
    C;
    break;
  case D:
    E;
    break;
  default:
    trace ("no specific case was encountered");
}

See also

switch, case, break