Auto-increment and auto-decrement Operators increase or decrease the value they are applied to by 1.
Symbol | Type | Name | Description | Example |
---|---|---|---|---|
Number | ||||
++ | Prefix | Pre-increment | Increments the term by 1, then returns the new value | ++a |
++ | Postfix | Post-increment | Returns the term value, then increments the term by 1 | a++ |
-- | Prefix | Pre-decrement | Decrements the term by 1, then returns the new value | --a |
-- | Postfix | Post-decrement | Returns the term value, then decrements the term by 1 | a-- |
The Operators will convert any non-Number to a Number first.
Auto-increment and auto-decrement Operators are designed for use on Variables. Using them on literal terms will work, but post-increment and post-decrement will have essentially no effect.