Operation
The value of the variable is incremented by one or descending one.
Syntax 1
result = ++variable
result = --variable
result = variable++
result = variable--
Syntax 2
++variable
--variable
variable++
variable--
Parameters
Result
Any variable .
Variable
Any variable.
Description
Increment and decrement operators, which are shortcuts for modifying values in existing variables. The value of an expression that contains one of these operators depends on whether the operator is preceded by a variable or after a variable:
++k;
Because increment occurs before the expression is evaluated, the value 3 is assigned to J.
Compared with the following example:
var j, k;k = 2;j = k++;
Here, because the increment occurs after the expression is evaluated, the value 2 is assigned to J.
Requirements
Version 1
Please see
Operator Precedence | Operator Summary