MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 37

Actionscript language reference
Table of Contents

Advertisement

Equality operators
You can use the equality (
operands are equal. This comparison returns a Boolean (
strings, numbers, or Boolean values, they are compared by value. If the operands are objects or
arrays, they are compared by reference.
It is a common mistake to use the assignment operator to check for equality. For example, the
following code compares x to 2:
if (x == 2)
In that same example, the expression
the operands; it assigns the value of 2 to the variable
The strict equality (
difference: The strict equality operator does not perform type conversion. If the two operands are
of different types, the strict equality operator returns
returns the opposite of the strict equality operator.
The following table lists the ActionScript equality operators:
Operator
Operation performed
Equality
==
===
Strict equality
!=
Inequality
Strict inequality
!==
Assignment operators
You can use the assignment (
following example:
var password:String = "Sk8tEr";
You can also use the assignment operator to assign multiple variables in the same expression. In
the following statement, the value of
a = b = c = d;
You can also use compound assignment operators to combine operations. Compound operators
perform on both operands and then assign the new value to the first operand. For example, the
following two statements are equivalent:
x += 15;
x = x + 15;
The assignment operator can also be used in the middle of an expression, as shown in the
following example:
// If the flavor is not vanilla, output a message.
if ((flavor = getIceCreamFlavor()) != "vanilla") {
trace ("Flavor was " + flavor + ", not vanilla.");
}
) operator to determine whether the values or references of two
==
if (x = 2)
) operator is similar to the equality operator, with one important
===
) operator to assign a value to a variable, as shown in the
=
is assigned to the variables
d
or
true
false
would be incorrect, because it doesn't compare
.
x
. The strict inequality (
false
Using operators to manipulate values in expressions
) value. If the operands are
) operator
!==
,
, and
:
a
b
c
37

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents