Some Stupid Bugs: Postfix Operators

Look out for:

Postfix Operator

Postfix operators have a way of creating insidious bugs. They seduce us with their expressiveness, and simplicity. They work so seamlessly when used in for loops, but can be easily misused. Two core mistakes I notice are:

  1. Unexpected side-effect: You want the next number, but you didn't actually mean for the original number to be mutated.
  2. Need the value immediately: You expected the value immediately, not after the operation.

Answer

Answers are hidden from search engines.
tips bugs postfix