Skip to main content
2 events
when toggle format what by license comment
Feb 28, 2018 at 9:09 comment added CompuChip Despite this question having some good answers already, I wanted to specifically upvote this because it makes an important point: to me, having anything other than a simple bound checking in the for-loop (for(...; i <= n; ...)) actually makes the code harder to read because I have to stop and think about what is happening here and might miss the condition altogether on the first pass because I don't expect it to be there. For me, a for loop implies that you are looping over some range, if there is a special exit condition it should be made explicit with an if, or you can use a while.
Feb 27, 2018 at 13:59 history answered allo CC BY-SA 3.0