Operators > == (equality)

== (equality)

Syntax

expression1 == expression2

Arguments

expression1,expression2 Numbers, strings, Booleans, variables, objects, arrays, or functions.

Description

Operator (equality); tests two expressions for equality. The result is true if the expressions are equal.

The definition of equal depends on the data type of the argument:

Numbers, strings, and Boolean values are compared by value, and are considered equal if they have the same value. For instance, two strings are equal if they have the same number of characters.
Variables, objects, arrays, and functions are compared by reference. Two variables are equal if they refer to the same object, array, or function. Two separate arrays are never considered equal, even if they have the same number of elements.

Player

Flash 5 or later.

Example

The following example uses the == operator with an if statement:

a = "David" , b = "David";
if (a == b){
trace("David is David");
}