The answer, from the same site:
http://stackoverflow.com/questions/24853/what-is-the-differe...
"++i will increment the value of i, and then return the incremented value."
"i++ will increment the value of i, but return the pre-incremented value."
http://stackoverflow.com/questions/24853/what-is-the-differe...
"++i will increment the value of i, and then return the incremented value."
"i++ will increment the value of i, but return the pre-incremented value."
i += i++;
Console.write(i);
could print 0, 1, or 2 depending on the order in which i++
and i += <value>
is evaluated. From the winning answer, what's really happening is: int i = 0;
i = i + i;
i + 1; // Note that you are discarding the calculation result
This kind of nonsense is the reason why Python doesn't have prefix and postfix increments.