This form is basically always used for enumeration.
Might as well just do (x != y); unless you're specifically looking to guard against erroneous bitflips that would be caught by the prior (x < y), but not the former. But at that point -- it's likely your result is going to be garbage.
In essence they're the same; but one you never have to think about whether you're using it correctly.
Can anyone find a reason not to swap out (x < y) for (x != y)?
`<` communicates the intent way better. It also more readable
Example: The loop should run as long as the counter is smaller than 10. `i /= 10` achieves the same thing but communicates something very different. It implies `i` may be changed inside the loop to become larger than 10. The condition itself implies a larger valid state space.
It's a moot point anyway. Modern languages have much better looping constructs.
(If I'm understanding correctly) one example is if have two places where you x++ in the loop, so if you make an error in there you might end up hitting both of them and incrementing from y-1 to y+1.
Might as well just do (x != y); unless you're specifically looking to guard against erroneous bitflips that would be caught by the prior (x < y), but not the former. But at that point -- it's likely your result is going to be garbage.
In essence they're the same; but one you never have to think about whether you're using it correctly.
Can anyone find a reason not to swap out (x < y) for (x != y)?