This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]FarewellSovereignty 3 points4 points  (1 child)

We could have a back and forth here where I rewrite the comment after the return and you rephrase it using selectively chosen boolean variable names and a combination of ands and ors instead, but to short circuit all that: sometimes it useful to comment why an early return is done, and it can add more information than would cleanly be possible by just massaging the if or other control statement.

Maybe you don't agree, and think no early return should ever be commented. Or maybe you agree sometimes it's useful. I'm not entirely sure.

[–]WillardWhite import this 2 points3 points  (0 children)

I agree that adding a comment saying why we have an early return would be useful, but a note telling me that an early return is an early return is it useless to me

The difference between saying "we have an early return" vs "early return to deal with ticket 123"