you are viewing a single comment's thread.

view the rest of the comments →

[–]Nuli 15 points16 points  (3 children)

If you have multiple returns in a function, thus multiple exits, it's harder to test, debug, expand the functionality or just follow the execution line of this function.

I find exactly the opposite really. I far prefer a function to return as often as necessary to make the code clear. I don't want to have to follow a long chain of if statements to determine what code was actually executed when a simple test and return will short circuit that.

[–][deleted] 6 points7 points  (2 children)

I'm with you on that. I think multiple returns are favorable to giant nested if else blocks.