else statement
if (condition){ statement(s); } else { statement(s); }
Specifies the statements to run if the condition in the
braces (
) used to enclose the block of statements to be executed by the
{}
not necessary if only one statement will execute.
Availability: ActionScript 1.0; Flash Lite 1.0
Parameters
condition:Boolean
Example
In the following example, the
greater than or less than 18:
if (age_txt.text>=18) { trace("welcome, user"); } else { trace("sorry,
junior"); userObject.minor = true; userObject.accessAllowed = false; }
In the following example, curly braces
follows the
statement:
else
if (age_txt.text>18) { trace("welcome, user"); } else trace("sorry,
junior");
See also
if statement
else if statement
if (condition){ statement(s); }
else if (condition){ statement(s);}
Evaluates a condition and specifies the statements to run if the condition in the initial
statement returns
false
the statements that follow the condition inside curly braces (
, Flash skips the statements inside the curly braces and runs the statements following
false
the curly braces.
Use the
statement to create branching logic in your scripts. If there are multiple
elseif
branches, you should consider using a
Availability: ActionScript 1.0; Flash Lite 1.0
192
ActionScript language elements
- An expression that evaluates to
condition is used to check whether the
else
({})
. If the
condition returns
else if
switch
statement returns
if
or
true
false
are not necessary because only one statement
, the Flash interpreter runs
true
). If the
{}
statement.
. The curly
false
statement are
else
.
variable is
age_txt
if
condition is
else if
Need help?
Do you have a question about the FLASHLITE2 ACTIONSCRIPT-LANGUAGE and is the answer not in the manual?
Questions and answers