Is there a technical reason to use > (<) instead of != when incrementing by 1 in a 'for' loop?

Zingam picture Zingam · Jul 16, 2015 · Viewed 14.4k times · Source

I almost never see a for loop like this:

for (int i = 0; 5 != i; ++i)
{}

Is there a technical reason to use > or < instead of != when incrementing by 1 in a for loop? Or this is more of a convention?

Answer

Antonio picture Antonio · Jul 16, 2015
while (time != 6:30pm) {
    Work();
}

It is 6:31pm... Damn, now my next chance to go home is tomorrow! :)

This to show that the stronger restriction mitigates risks and is probably more intuitive to understand.