> Irrational fear of a second return has lead to lots of unnecessary code 
> branches, in my experience. I'd rather see a return early in a function that 
> a nested if branch that includes the rest of the body of the function.
>   
I think it is entirely rational to avoid second returns.  (In cases
where there are a lot of early-exit tests, I would agree that multiple
returns are better than multiple nested if-then-elses.)  However, I
looked up the Sun Java coding conventions and found no mention of this,
so I don't know of any authority to which I can appeal to support my
case.  To me, code is more readily understandable if each unit has a
single exit point.


Reply via email to