Should a function have only one return statement?

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2008-08-31T09:26:55Z Indexed on 2010/04/04 5:03 UTC
Read the original article Hit count: 281

Are there good reasons why it's a better practice to have only one return statement in a function?

Or is it okay to return from a function as soon as it is logically correct to do so, meaning there may be many return statements in the function?

© Stack Overflow or respective owner

Related posts about best-practices

Related posts about language-agnostic