in reply to Re^2: return if defined
in thread return if defined
I view your sample code the very thing wrong with the "single return" principle. My dogma is: return as early as you can if it avoids extra indentation.
(One of the usual offenders is a lengthy if {} block with the main logic, coupled with a short else {} block whose only purpose is to return some error value. Just reverse the blocks' order and the main logic no longer needs an extra indent level!)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: return if defined
by Anonymous Monk on Dec 20, 2012 at 13:39 UTC | |
by Anonymous Monk on Dec 20, 2012 at 13:55 UTC | |
by tobyink (Canon) on Dec 20, 2012 at 14:14 UTC |