152
ActionScript language elements
This script displays the following result in the Output panel:
0,1,2,3,4,5,6,7,8,9
!= inequality operator
expression1
!=
expression2
Tests for the exact opposite of the equality (
==
) operator. If
expression1
is equal to
expression2
, the result is
false
. As with the 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.
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
expression1
and
expression2
are different data types,
ActionScript will attempt to convert the data type of
expression2
to match that of
expression1
.
Availability:
ActionScript 1.0; Flash Lite 2.0
Operands
expression1 :
Object
- A number, string, Boolean value, variable, object, array, or
function.
expression2 :
Object
- A number, string, Boolean value, variable, object, array, or
function.
Returns
Boolean
- The Boolean result of the comparison.
Example
The following example illustrates the result of the inequality (
!=
) operator:
trace(5 != 8); // returns true
trace(5 != 5) //returns false
Summary of Contents for FLASHLITE2 ACTIONSCRIPT-LANGUAGE
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...