Logical Or Operator - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

|| logical OR operator

expression1 || expression2
Evaluates
expression1
the expression evaluates to
expression on the right side of the operator) is evaluated. If
the final result is
false
If you use a function call as
evaluates to true.
expression1
The result is
if either or both expressions evaluate to
true
both expressions evaluate to
operands; if any operand evaluates to
Availability: ActionScript 1.0; Flash Lite 1.0
Operands
expression1 :
Number
expression2 :
Number
Returns
- The result of the logical operation.
Boolean
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 appears because one of the conditions in the
statement is true (
y>200
one condition evaluates to
162
ActionScript language elements
(the expression on the left side of the operator) and returns
. If
true
expression1
; otherwise, it is
true
, the function will not be executed by that call if
expression2
. You can use the logical OR operator with any number of
false
, the result is
true
- A Boolean value or an expression that converts to a Boolean value.
- A Boolean value or an expression that converts to a Boolean value.
so the final result is
true,
). Although the other two expressions evaluate to
the
block is executed.
true,
if
evaluates to
false
expression2
.
; the result is
true
.
true
) operator in an
||
if
:
true
true
,
(the
expression2
evaluates to
false
only if
false
statement. The second
if
, as long as
false
if
,

Advertisement

Table of Contents
loading

Table of Contents