&& (logical AND)
Availability
Flash Player 4.
Usage
expression1 && expression2
Parameters
None.
Returns
A Boolean value.
Description
Operator (logical); performs a Boolean operation on the values of one or both of the expressions.
Evaluates
expression1
expression evaluates to
on the right side of the operator) is evaluated. If
; otherwise, it is
true
Expression
true&&true
true&&false
false&&false
false&&true
For more information, see "Operator precedence and associativity" in Using ActionScript in Flash.
Example
The following example uses the logical AND (
player has won the game. The
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!
*/
38
Chapter 2: ActionScript Language Reference
(the expression on the left side of the operator) and returns
. If
false
expression1
.
false
Evaluates
true
false
false
false
variable and the
turns
evaluates to
,
true
expression2
evaluates to
expression2
) operator to perform a test to determine if a
&&
variable are updated when a player
score
if the
false
(the expression
, the final result is
true
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers