!= inequality operator
expression1 != expression2
Tests for the exact opposite of the equality (
, the result is
expression2
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.
Comparison by value means what most people would expect equals to mean--that two
expressions have the same value. For example, the expression (2 + 3) is equal to the expression
(1 + 4) when compared by value.
Comparison by reference means that two expressions are equal only if they both refer to the
same object, array, or function. Values inside the object, array, or function are not compared.
When comparing by value, if
ActionScript will attempt to convert the data type of
.
expression1
Availability: ActionScript 1.0; Flash Player 5
Operands
expression1 : Object
function.
expression2 : Object
function.
Returns
- The Boolean result of the comparison.
Boolean
Example
The following example illustrates the result of the inequality (
trace(5 != 8); // returns true
trace(5 != 5) //returns false
The following example illustrates the use of the inequality (
var a:String = "David";
var b:String = "Fool";
if (a != b) {
trace("David is not a fool");
}
166
ActionScript language elements
==
. As with the equality (
false
and
expression1
- A number, string, Boolean value, variable, object, array, or
- A number, string, Boolean value, variable, object, array, or
) operator. If
expression1
) operator, the definition of equal
==
are different data types,
expression2
expression2
) operator:
!=
) operator in an
!=
is equal to
to match that of
statement:
if
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?