Parameters
None.
Returns
A number.
Description
Operator (arithmetic); calculates the remainder of
either of the
expression
convert them to numbers. The
value. For more information, see
and associativity" on page
Example
The following numeric example uses the modulo (
trace(12%5); // traces 2
trace(4.3%2.1); // traces 0.0999999999999996
trace(4%4); // traces 0
The first trace returns 2, rather than 12/5 or 2.4, because the modulo (
the remainder. The second trace returns 0.0999999999999996 instead of the expected 0.1
because of the limitations of floating-point accuracy in binary computing.
See Also
.
/ (division)
%= (modulo assignment)
Availability
Flash Player 4.
Usage
expression1 %= expression2
Parameters
None.
Returns
A number.
Description
Operator (arithmetic compound assignment); assigns
. The following two expressions are equivalent:
expression2
x %= y
x = x % y
For more information, see
88
Chapter 5: ActionScript Core Language Elements
parameters are non-numeric, the modulo (
can be a number or string that converts to a numeric
expression
"Automatic data typing" on page 24
32.
"Operator precedence and associativity" on page
divided by
expression1
) operator attempts to
%
and
operator:
%)
) operator returns only
%
the value of
expression1
. If
expression2
"Operator precedence
expression1 %
32.
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers