Re: Return or not to return, that is the question

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

 



2007. 05. 30, szerda keltezéssel 11.52-kor Richard Davey ezt írta:
> Hi all,
> 
> Just a quick straw-poll really:
> 
> What is your take on using 'return' when you end a function, if you
> don't actually need to return a value?
> 
> If you have to return say a true/false as the result of an operation,
> then it's an obvious choice. But what if all the function does is
> perform an action and then quit? Do you like to use 'return' at the
> end of it anyway, or do you just let it run into the closing } ?
> 
> Or do you perhaps do a 'return true' at the end, regardless, even if
> the rest of your code never checks that value (on the basis that it
> may do in the future)

personally I prefer to use return only if I need the return value for
something. If it's not used then I think it's just a waste of code lines
and resources to return anything...

greets
Zoltán Németh

> 
> Cheers,
> 
> Rich
> -- 
> Zend Certified Engineer
> http://www.corephp.co.uk
> 
> "Never trust a computer you can't throw out of a window"
> 

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