3 ms·
The answer, from the same site: http://stackoverflow.com/questions/24853/what-is-the-difference-between-i-and-i http://stackoverflow.com/questions/24853/what-i
by Claudus 14y ago
The answer, from the same site:
http://stackoverflow.com/questions/24853/what-is-the-difference-between-i-and-i 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."
- keefe 14y agoyep that's 101 stuff eh?
- yen223 14y agoIt's a bit more subtle than that. 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.