3 ms·
It'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 evalu
by yen223 14y ago
It'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.