MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 110

Actionscript language reference
Table of Contents

Advertisement

Returns
A Boolean value.
Description
Operator (logical); evaluates
returns
if the expression evaluates to
true
(the expression on the right side of the operator) is evaluated. If
expression2
evaluates to
false
If you use a function call as
evaluates to true.
expression1
The result is
true
expressions evaluate to
if any operand evaluates to
For more information, see
Example
The following example uses the logical OR (
expression evaluates to
var x:Number = 10;
var y:Number = 250;
var start:Boolean = false;
if ((x>25) || (y>200) || (start)) {
trace("the logical OR test passed"); // output: the logical OR test passed
}
The message
the logical OR test passed
statement is true (
condition evaluates to
The following example demonstrates how using a function call as
unexpected results. If the expression on the left of the operator evaluates to
returned without evaluating the expression on the right (the function
function fx1():Boolean {
trace("fx1 called");
return true;
}
function fx2():Boolean {
trace("fx2 called");
return true;
}
if (fx1() || fx2()) {
trace("IF statement entered");
}
/* The following is sent to the log file:
fx1 called
IF statement entered
*/
110
Chapter 5: ActionScript Core Language Elements
expression1
, the final result is
false
expression2
if either or both expressions evaluate to
. You can use the logical OR operator with any number of operands;
false
, the result is
true
"Operator precedence and associativity" on page
so the final result is
true,
). Although the other two expressions evaluate to
y>200
the
block executes.
true,
if
(the expression on the left side of the operator) and
. If
true
expression1
; otherwise, it is
true
, the function will not be executed by that call if
; the result is
true
.
true
) operator in an
||
if
:
true
appears because one of the conditions in the
evaluates to
,
false
expression2
.
only if both
false
32.
statement. The second
, as long as one
false
can lead to
expression2
, that result is
true
is not called).
fx2()
if

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flex

Table of Contents