(Inequality) - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

!= (inequality)

Availability
Flash Player 5.
Usage
expression1 != expression2
Parameters
None.
Returns
A Boolean value.
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 "Automatic data typing" and "Operator precedence and
expression1
associativity" in Using ActionScript in Flash.
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() {
30
Chapter 2: ActionScript Language Reference
, the result is
. As with the equality (
false
expression1
==
==
and
are different data types,
expression2
expression2
) operator:
!=
) operator in an
!=
) operator. If
expression1
) operator, the definition of
to match that of
statement:
if
is

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Flash mx

Table of Contents