Dutton

Silly for loop syntax

I've been working with C-style languages for over 12 years now, but stumbled across this funny for loop syntax in a code tutorial today and had to double-take:

for (int i = 2; i --> 0;)
{
    // do something
}

Although technically correct, quite what you gain from putting the iterator within the condition apart from confusion is lost on me.


Share this: