Re: Long Live GOTO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Robert Cummings" <robert@xxxxxxxxxxxxx> wrote in message 
news:4F30086A.6080904@xxxxxxxxxxxxx...
 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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux