Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

There is nothing wrong with having multiple return statements especially to break out of nested ifs.

Here is some discussion on SO about this very topic

http://stackoverflow.com/questions/36707/should-a-function-have-only-one-return-statement

Additional discussion on GOTO

http://stackoverflow.com/questions/46586/goto-still-considered-harmful

There is nothing wrong with having multiple return statements especially to break out of nested ifs.

Here is some discussion on SO about this very topic

https://stackoverflow.com/questions/36707/should-a-function-have-only-one-return-statement

Additional discussion on GOTO

https://stackoverflow.com/questions/46586/goto-still-considered-harmful

Post Migrated Here from stackoverflow.com (revisions)
Source Link
Kal
  • 101

There is nothing wrong with having multiple return statements especially to break out of nested ifs.

Here is some discussion on SO about this very topic

http://stackoverflow.com/questions/36707/should-a-function-have-only-one-return-statement

Additional discussion on GOTO

http://stackoverflow.com/questions/46586/goto-still-considered-harmful