Re: Multiple return statements in a function.

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

 



On Thu, Apr 23, 2009 at 10:14:28AM -0400, tedd wrote:

> At 2:19 PM +0100 4/23/09, Tony Marston wrote:

<snip>

>> There is no such "rule", it is a matter of personal preference. As a
>> previous poster has already said, if you want to leave a function early 
>> and
>> ignore all subsequent processing it is easier to understand if you return
>> immediately rather than have a mechanism to jump over the remaining code 
>> to
>> a single return point. In the good old days we used to use the GOTO in 
>> COBOL
>> to jump to the exit point, but then people found a way to abuse GOTO in 
>> very
>> imaginatve ways.
>>
>>>  The "benefit" is easier to read code.
>>
>> I think that an immediate return is easier to read, but what do I know -
>> I've only been programming for 30 years.
>>
>> --
>> Tony Marston
>
> Tony:
>
> Don't get your panties in a knot. :-)

I think in Tony's case, it would "knickers in a twist". ;-}

Paul

-- 
Paul M. Foster

-- 
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