Operators
177
Availability:
ActionScript 1.0; Flash Player 4
Operands
condition1 : Boolean
- An expression that evaluates to
true
or
false
.
condition2 : Boolean
- An expression that evaluates to
true
or
false
.
Returns
Boolean
- The result of the logical operation.
See also
|| logical OR operator
,
| bitwise OR operator
% modulo operator
expression1
%
expression2
Calculates the remainder of
expression1
divided by
expression2
. If either of the
expression
parameters are non-numeric, the modulo (
%
) operator attempts to convert them
to numbers. The
expression
can be a number or string that converts to a numeric value.
The sign of the result of modulo operation matches the sign of the dividend (the first
number). For example,
-4 % 3
and
-4 % -3
both evaluate to
-1
.
Availability:
ActionScript 1.0; Flash Player 4 - In Flash 4 files, the
%
operator is expanded in
the SWF file as
x - int(x/y) * y
and may not be as fast or as accurate in later versions of
Flash Player.
Operands
expression1 : Number
- A number or expression that evaluates to a number.
expression2 : Number
- A number or expression that evaluates to a number.
Returns
Number
- The result of the arithmetic operation.
Example
The following numeric example uses the modulo (
%
) operator:
trace(12%5); // traces 2
trace(4.3%2.1); // traces 0.0999999999999996
trace(4%4); // traces 0
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...