Increment and Decrement Operators

 

SPL supports both increment and decrement operators:

 

Operator

Description

++n

pre-increment

--n

pre-decrement

n++

post-increment

n--

post decrement

 

The ++ and -- operators increment and decrement variables. Both operators may be used in prefix or postfix form. The expression ++n increments n before using its value, while n++ increments n after its value has been used.