User Guide
% (modulo) 87
Description
Operator; tests for the exact opposite of the strict equality (===) operator. The strict inequality
operator performs the same as the inequality operator except that data types are not converted.
For more information, see “Automatic data typing” on page 24. If
expression1 is equal to
expression2, and their data types are equal, the result is false. As with the strict equality (===)
operator, the definition of equal depends on the data types being compared, as illustrated in the
following list:
• Numbers, strings, and Boolean values are compared by value.
• Objects, arrays, and functions are compared by reference.
• A variable is compared by value or by reference, depending on its type.
For more information, see “Operator precedence and associativity” on page 32.
Example
The comments in the following code show the returned value of operations that use the equality
(
==), strict equality (===), and strict inequality (!==) operators:
var s1:String = "5";
var s2:String = "5";
var s3:String = "Hello";
var n:Number = 5;
var b:Boolean = true;
trace(s1 == s2); // true
trace(s1 == s3); // false
trace(s1 == n); // true
trace(s1 == b); // false
trace(s1 === s2); // true
trace(s1 === s3); // false
trace(s1 === n); // false
trace(s1 === b); // false
trace(s1 !== s2); // false
trace(s1 !== s3); // true
trace(s1 !== n); // true
trace(s1 !== b); // true
See also
! (logical NOT)
, != (inequality), && (logical AND), || (logical OR), == (equality),
=== (strict equality)
% (modulo)
Availability
Flash Player 4.
Usage
expression1 % expression2