Hacker News new | ask | show | jobs
by dtzWill 4107 days ago
Nothing, really.

There's an argument that using a 'for' construct groups together the details of the loop (initialization, the loop condition, iteration update), which can aid readability.

(You don't have to search the loop body to find how things change between iterations)

Of course, nothing forces a for() loop to have iteration behavior entirely dependent on only what's in the 'for'. In my experience this seems to be discouraged, however, preferring to use 'for' only when there is a predictable and simple iteration pattern.

In the end, it's just a matter of preference and style. :)