Operators are used to manipulate variables in expressions.
Operator | Operator Name | Syntax | Arguments and Description |
---|---|---|---|
- | decrement | --expression expression- |
--expression
Subtracts 1 from expression and returns the result. expression-- Subtracts 1 from the expression and returns the initial value of the expression. |
++ | increment | ++expression expression++ |
++expression
Adds 1 to the expression and returns the result. expression++ Adds 1 to the expression and returns the initial value of the expression. |
! | logical NOT | !expression | If expression was set to true, !expression would return false. |
!= | inequality | expression1 != expression2 | If expression1 is not equal to expression2, it returns true. |
% | modulo | expression1 % expression2 | Calculates the remainder of expression1 divided by expression2. |
%= | modulo assignment | expression1 %= expression2 | Calculates the remainder of expression1 divided by expression2 and assigns the value to expression1. |
& | bitwise assignment | expression1 & expression2 | Converts expression1 and expression2 to 32-bit unsigned integers and performs a Boolean AND operation; a new 32-bit unsigned integer is returned. |
minus | Used for negating or subtracting. | ||
-expression1 | -expression1 negates the value contained in expression1. | ||
expression1 - expression2 | expression1-expression2 Subtracts the value of expression2 from expression1. | ||
* | multiplication | expression1 * expression2 | expression1 * expression2 Multiplies the numbers. |
*= | multiplication assignment | expression1 *= expression2 | expression1 * expression2 Multiplies the numbers and assigns the value to expression1. |
?: | conditional | expression1 ? expression2 : expression3 | expression1 ? expression2 : expression3 Instructs Flash to evaluate expression1 and return the value of expression2 if expression1 is true; otherwise, return the value of the expression3. |
/ | division | expression1 / expression2 | expression1 / expression2 Divides the numbers. |
// | comment delimiter | // comment | |
/= | division assignment | expression1 /= expression2 | expression1 / expression2 Divides the numbers and assigns the values to expression1. |
^ | bitwise XOR | expression1 ^ expression2 | Converts expression1 and expression2 to 32-bit unsigned integers and performs a Boolean OR operation; a new 32-bit unsigned integer is returned. |
^= | bitwise XOR assignment | expression1 ^= expression2 | Converts expression1 and expression2 to 32-bit unsigned integers and performs a Boolean AND operation; a new 32-bit unsigned integer is returned and assigns the value to expression1. |
| | bitwise OR | expression1 | expression2 | Converts expression1 and expression2 to 32-bit unsigned integers and returns a 1 in each bit position where the corresponding bits of either expression1 or expression2 are 1. |
|| | logical OR | expression1 || expression2 | Evaluates expression1 and expression2, and if both expression1 and expression2 are true, returns true. |
| = | bitwise OR assignment | expression1 | + expression2 | Converts expression1 and expression2 to 32-bit unsigned integers and returns a 1 in each bit position where the corresponding bits of either expression1 or expression2 are 1, and then assigns the value to expression1. |
∼ | bitwise NOT | ∼ expression | Converts the expression to a 32-bit unsigned integer, and then reverses the value of the bits. |
+ | addition | expression1 + expression2 | Adds numeric expressions and concatenates strings. |
+= | addition assignment | expression1 += expression2 | Adds numeric expressions and concatenates strings and assigns the value to expression1. |
< | less than | expression1 < expression2 | Compares two expressions and determines whether expression1 is less than expression2. |
<< | bitwise left shift | expression1 << expression2 | Converts expression1 and expression2 to 32-bit integers and shifts all bits in expression1 to the left by the number of places specified by the integer resulting from the conversion of expression2. |
<<= | bitwise left shift and assignment | expression1 <<= expression2 | Converts expression1 and expression2 to 32-bit integers, shifts all bits in expression1 to the left by the number of places specified by the integer resulting from the conversion of expression2, and assigns the value to expression1. |
<= | less than or equal to | expression1 <= expression2 | Returns true when expression1 is less than or equal to expression2; returns false when expression1 is greater than expression2. |
<> | inequality | expression1 <> expression2 | Returns true when expression1 is not equal to expression2. |
= | assignment | expression1 = expression2 | Assigns the value of expression2 to expression1. |
-= | negation assignment | expression1 -= expression2 | Subtracts the two numbers and assigns the value to expression1. |
== | equality | expression1 == expression2 | If expression1 is equal to expression2, it returns true. |
> | greater than | expression1 > expression2 | Returns true when expression1 is greater than expression2; returns false when expression1 is less than or equal to expression2. |
>= | greater than or equal to | expression1 >= expression2 | Returns true when expression1 is greater than expression2; returns false when expression1 is less than expression2. |
>> | bitwise shift right | expression1 >> expression2 | Converts expression1 and expression2 to 32-bit integers and shifts all bits in expression1 to the right by the number of places specified by the integer resulting from the conversion of expression2. |
>>= | bitwise shift right and assignment | expression1 >>= expression2 | Converts expression1 and expression2 to 32-bit integers, shifts all bits in expression1 to the right by the number of places specified by the integer resulting from the conversion of expression2, and assigns the value to expression1. |
>>> | bitwise unsigned right shift | expression1 >>> expression2 | Same as the bitwise right-shift operator (>>), except that it does not preserve the sign of the original expression because the bits on the left are always filled with 0. |
>>>= | bitwise unsigned right shift and assignment | expression1 >>>= expression2 | Same as the bitwise right-shift operator (>>), except that it does not preserve the sign of the original expression because the bits on the left are always filled with 0; assigns the value to expression1. |