I don't think I'll ever understand the, for(i = n; i > 0; i--) {} camp. Even when semantically you're writing a countdown, it's surprising enough to be costly.
IMO, yes. If your language has a range construct, that's better. But when you're just using a loop to do something `n` times, I think ++ is better than -- because my brain just erases the whole thing and immediately sees "range".
-
-
Prob depends what you’re doing but in computational sciences it’s hugely important to make code read like the equations it implements and they are always written for some series i = 1, 2, ..., n
-
Yea, absolutely. TBH, that may be why I experience such dissonance when I see the decrementing loop. If it's not just "do n times" then I anticipate sequenced indexing.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.