Actionscript conditional statements allows us to run a code only if the a condition is matched. The syntax of conditional statements in actionscript is given here
if(condition)
{
//perform this task,
}
An example of Conditional statement in actionscript is here
var myVar1:Number = 3;
if(myVar == 5){
trace("myVar is 5");
}
//the result is myVar is 5
Conditional statements can also use else if and else statements. else if is used when we want to evaluate another condition, else is used, when the evaluated conditions are not true.
var myVar1:Number = 3;
if(myVar == 5){
trace("myVar is 5");
}
else if(myVar == 4){
trace("myVar is 4");
}
else{
trace("do you know the value of myVar?");
}
//the code will output do you know the value of myVar?