This may seem like a silly question, but why do many languages have a prefix and postfix version of the operator ++and --, but there are no similar versions of the prefix / postfix of other operators, such as +=or -=? For example, it seems that if I can write this code:
myArray[x++] = 137; // Write 137 to array index at x, then increment x
I should write something like
myArray[5 =+ x] = 137; // Write 137 to array index at x, then add five to x
Of course, such an operator does not exist. Is there a reason for this? This seems like weird asymmetry in C / C ++ / Java.
source
share