3 ms·
> If one version can include significantly fewer comments without issue then that’s good sign. Which is why I don't buy what the article tries to sell, at lea
by magicalhippo 8y ago
> If one version can include significantly fewer comments without issue then that’s good sign.
Which is why I don't buy what the article tries to sell, at least not fully.
In the first example, having a few initial handle-and-exit if statements to deal with edge cases, and a main body that's clean means you don't need to comment.
The approach suggested by some here that you could just have two for loops over the input, while clever, might not be immediately obvious to everyone and as such would probably need a comment explaining it.
The latter does not need special case handling, but is less obvious.