Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript language elements > Operators > && logical AND operator | |||
expression1 && expression2
Performs a Boolean operation on the values of both expressions. If expression1 and expression2 are both true, then true is returned; otherwise, false is returned.
|
Expression |
Evaluates |
|---|---|
|
|
true |
|
|
false |
|
|
false |
|
|
false |
Availability: ActionScript 1.0; Flash Player 4
expression1 : Number - A Boolean value or an expression that converts to a Boolean value.
expression2 : Number - A Boolean value or an expression that converts to a Boolean value.
Boolean - A Boolean result of the logical operation.
The following example uses the logical AND (&&) operator to perform a test to determine if a player has won the game. The turns variable and the score variable are updated when a player takes a turn or scores points during the game. The script shows "You Win the Game!" in the Output panel when the player's score reaches 75 or higher in 3 turns or less.
var turns:Number = 2;
var score:Number = 77;
if ((turns <= 3) && (score >= 75)) {
trace("You Win the Game!");
} else {
trace("Try Again!");
}
// output: You Win the Game!
! logical NOT operator, != inequality operator, !== strict inequality operator, || logical OR operator, == equality operator, === strict equality operator
Flash CS3
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00001288.html
Comments
Fumio Nonaka said on Aug 26, 2007 at 10:26 AM :