Modulo Assignment Operator - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

The first trace returns 2, rather than 12/5 or 2.4, because the modulo (
only 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 operator

%= modulo assignment operator

expression1 %= expression2
Assigns
expression1
statements are equivalent:
x %= y;
x = x % y;
Availability: ActionScript 1.0; Flash Player 4 - In Flash 4 files, the
the SWF file as
x - int(x/y) * y
Flash Player.
Operands
expression1 : Number
expression2 : Number
Returns
- The result of the arithmetic operation.
Number
Example
The following example assigns the value
var x:Number = 14;
var y:Number = 5;
trace(x = y); // output: 4
See also
% modulo operator
178
ActionScript language elements
,
round (Math.round method)
the value of
expression1 % expression2
and may not be as fast or as accurate in later versions of
- A number or expression that evaluates to a number.
- A number or expression that evaluates to a number.
to the variable
4
) operator returns
%
. The following two
operator is expanded in
%
:
x

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF