r/programming • u/balazsbotond • Aug 30 '15
JavaScript “maze generator” in a tweet
https://twitter.com/botond_balazs/status/637960240055615488
841
Upvotes
r/programming • u/balazsbotond • Aug 30 '15
View all comments
Show parent comment
-6
u/Anders_A Aug 30 '15
You are mistaken.
Remember that this isn't in the update part of the for statement (which is not run the first time). The loop termination condition is checked before the first run so both loops N times. But one goes from N to 1 and the other from N-1 to 0.
Either one works, but with i-- you get a line break before the first line and not after the last, and the other way around with --i which was the behaviour I preferred.