...

/

Other Convenient Operators

Other Convenient Operators

Learn about some convenient shorthand operators like the prefix and postfix operators to increment and decrement, and the compound assignment operators.

Some operators are convenient shorthands for what would normally be a two-step computation.

The ++ and -- operators

You may come across two unusual-looking operators that may be used as a shorthand for incrementing and decrementing variables. The ++ and -- operators add 1 and subtract 1, respectively, from their operands. For example in the following code snippet, we increment the int variable a ...