Flash Lite 2 |
|||
| Flash Lite 2.x ActionScript Language Reference > ActionScript language elements > Statements > default statement | |||
default: statements
Defines the default case for a switch statement. The statements execute if the expression parameter of the switch statement doesn't equal (using the strict equality [===] operation) any of the expression parameters that follow the case keywords for a given switch statement.
A switch is not required to have a default case statement. A default case statement does not have to be last in the list. If you use a default statement outside a switch statement, it produces an error and the script doesn't compile.
Availability: ActionScript 1.0; Flash Lite 2.0
statements:String - Any statements.
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() statement is sent to the Output panel.
var dayOfWeek:Number = new Date().getDay();
switch (dayOfWeek) {
case 1 :
trace("Monday");
break;
case 2 :
trace("Tuesday");
break;
case 3 :
trace("Wednesday");
break;
case 4 :
trace("Thursday");
break;
case 5 :
trace("Friday");
break;
default :
trace("Weekend");
}