Re: Multiple return statements in a function.

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

 



Richard Heyes wrote:

> Hi,
> 
>> while(true){
> 
> Yikes.
> 
> Personally, I'd put the return value wherever it will make the code
> easier to read. If you're checking what has been passed as arguments,
> and one of them is wrong, I think there's little point in continuing,
> so an immediate return is the order of the day.

Well, I usually use that construct where I can have a number of
different error-conditions - e.g. if I have a sequence of socket
create, DNS lookup, bind, connect  etc. 


/Per

-- 
Per Jessen, Zürich (15.6°C)


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