Numeric operators add, subtract, multiply, divide, and perform other arithmetic operations.
The most common usage of the increment operator is i++
instead of the more verbose i = i+1
. You can use the increment operator before or after an operand. In the following example, age
is incremented first and then tested against the number 30:
if (++age >= 30)
In the following example, age
is incremented after the test is performed:
if (age++ >= 30)
The following table lists the ActionScript numeric operators:
Operator | Operation performed |
+ |
Addition |
* |
Multiplication |
/ |
Division |
% |
Modulo (remainder of division) |
- |
Subtraction |
++ |
Increment |
-- |
Decrement |