MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 85

Actionscript language reference
Table of Contents

Advertisement

Description
Operator (inequality); tests for the exact opposite of the equality (
equal to
expression2
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
ActionScript will attempt to convert the data type of
. For more information, see
expression1
precedence and associativity" on page
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");
}
The following example illustrates comparison by reference with two functions:
var a:Function = function() {
trace("foo");
};
var b:Function = function() {
trace("foo");
};
a(); // foo
b(); // foo
trace(a!=b); // true
a = b;
a(); // foo
b(); // foo
trace(a!=b); // false
// trace statement output:
foo
foo
, the result is
. As with the equality (
false
expression1
"Automatic data typing" on page 24
32.
==
==
and
are different data types,
expression2
expression2
) operator:
!=
) operator in an
!=
) operator. If
expression1
) operator, the definition of
to match that of
and
"Operator
statement:
if
!= (inequality)
is
85

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Flex

Table of Contents