I’ve heard somewhere that in the actual internal implementation for the 2 postfix unary operators (var++
& var--
), they 1st cache the variable’s current value before updating it. And then they return that cached original value.
It’s very common to state that the postfix increment unary operator var++
corresponds to var = var + 1
or to var += 1
.
However, that’s misguidingly wrong! B/c they correspond to the prefix increment unary operator ++var
instead, if they’re used inside expressions!