!= (inequality)
Top  Previous  Next


SWiSH Player Support
SWF5 or later - Supported Internally

Syntax
expression1 != expression2

Arguments
None.

Returns
false if (expression1 == expression2)

Description
Operator (inequality); tests for the exact opposite of the == operator. If expression1 is equal to expression2, the result is false. As with the == operator, the definition of equal depends on the data types being compared:

The definition of equal depends on the data type of the parameter:
·If both of the two values are strings, they are compared as strings. Otherwise, any strings are converted to numbers before being compared.  
·If the values are numbers, then the values are compared  

Note:
For SWF4 only, comparing a variable and a string will assume the variable also contains a string, and will do a string comparison. For SWF5+ the actual type of value in the variable is used as above to determine how to compare.
   
Sample
The following example illustrates the result of the != operator:
5 != 8 returns true
5 != 5 returns false

This example illustrates the use of the != operator in an if statement:
a = "David";
b = "Fool" ;
if (a != b){
    trace("David is not a fool");
}