This is a fun one...
[Edit]
In addition to the below, the main cause is short circuit evaluation. See Solution 2.
What is the difference between:
x++
and
++x
?
The first returns the value FIRST, then increments x. So if I wrote:
int x = 10;
int y = x++;
and after looking at the evaluation, x would be 11, and y would be 10.
Alternatively, if I wrote:
int x = 10;
int y = ++x;
after evaluation, x and y would both be 11.
So in your case:
if ((y >= 10) || (x++ > 10)) {
}
Since you don't give the whole line, I can only assume that this is in an if statement.
If you wrote something like:
int y = 9;
int x = 10;
if ((y >= 10) || (x++ > 10) || (x > 10))
{
}
The first (x++ > 10) would evaluate to false, but (x > 10) would evaluate to true.