"Robert Cummings" <rob...@interjinn.com> wrote in message 
 1) deal with the trivial and error cases first
> Some say you should never return early from a function... I too think that 
> early returns can improve the readability of a function-- 
> especially if they are short snippets of logic that clearly indicate the 
> reason for an early exit (usually edge case constraints).
> :)
> Cheers,
> Rob.
> -- 

I agree.  Using multiple returns is merely a goto.  Maintenance of that 
function must then take into account those "multiple paths" in that function 
as the changes are added.  Modifying the original function to remove the 
returns so that *all* flows will encounter the 'new' code can cause problems 
if today's author misses something in the logical path of the process(es). 

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to