Re:We Are Sorry to Inform You (2005)
by cebert on Saturday June 18, 2022 @08:59AM
(#31789439)
I think it depends on the situation, but a single return statement per method does make it a bit easier to read a method and understand flow control.
[ Parent
| on HN ]
At the top of the function, "if [special input] return [special output]" is a great way of handling edge cases
Really exit can be pretty useful though.
Doing if(condition) return at the start, before it gets going often reduces indentation and how many branches you need to see at once.
But I can agree sneaky returns can bite you sometimes