|
Spec-Zone .ru
спецификации, руководства, описания, API
|
Table 6.8. Postfix Increment/Decrement Operators
| Operator | Meaning | Operand Type | Result Type |
|---|---|---|---|
| ++ | Add one to the value of the operand, value is the previous value | ++ Integer | Integer |
| ++ Number | Number | ||
| -- | Subtract one from the value of the operand, value is the previous value | -- Integer | Integer |
| -- Number | Number |
This example contrasts these postfix increment/decrement operators with the prefix operators in unaryExpression:
var x = 0; println( x++ ); println( ++x ); println( x-- ); println( --x );
The following is printed on the console:
0 2 2 0