[development] comment module: minor issue unreachable code
Earnie Boyd
earnie at users.sourceforge.net
Thu Aug 23 13:54:19 UTC 2007
Quoting Bèr Kessels <ber at webschuur.com>:
> Op woensdag 22 augustus 2007, schreef Earnie Boyd:
>> As you can see I don't think break is always a good thing, it should
>> either be return or break and return should not be embodied in the
>> case.
>
> having more then one return in a function is generally a (very) bad practice.
> It makes the code hard to read, and far more complex then needed.
>
As you say "generally" not advisable to do. But I think by your second
sentence that you mean that it is more difficult to find all of the
exit points in the function if more than one return is used. And even
though I tend to use only one in longer coded functions I will break
from the practice on occasion for smaller line count functions. And
thank the Gods that PHP doesn't contain a goto statement but it might
someday[1].
[1] http://www.php.net/~derick/meeting-notes.html#adding-goto
Earnie
More information about the development
mailing list