Multiple exit statements in a method - good or bad practice
818236Mar 7 2011 — edited Mar 9 2011Hi Java-lovers,
I happened to read through this article: http://www.theserverside.com/tip/A-return-to-Good-Code on "theserverside.com" about how having multiple exit statements in a method is bad coding practice.
However when you glance through the comments on the article, you will find people showering mixed reactions on that statement.
I want to know what should be the proper road to take while writing code.
Is there a logic which should decide which method to follow?
Thanking you in advance for your able guidance.
Searching over google I found the following links:
http://stackoverflow.com/questions/2939162/is-it-bad-to-have-multiple-return-statements
http://stackoverflow.com/questions/36707/should-a-function-have-only-one-return-statement
Static code analyzers will point out multiple exit statements as a negative pointer!