Understanding the ActionScript Language > Controlling flow in scripts > Checking a condition |  |

Checking a condition

Statements that check whether a condition is `true` or `false` begin with the term `if`. If the condition exists, ActionScript executes the statement that follows. If the condition doesn't exist, ActionScript skips to the next statement outside the block of code.

To optimize your code's performance, check for the most likely conditions first.

The following statements test several conditions. The term `else if` specifies alternative tests to perform if previous conditions are false.

    if (password == null || email == null) {
    	gotoAndStop("reject");
    }	else if (password == userID){
    	gotoAndPlay("startMovie");
    }