Return or not to return, that is the question
- From: rich@xxxxxxxxxxxxx (Richard Davey)
- Date: Wed, 30 May 2007 11:52:16 +0100
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)
Cheers,
Rich
--
Zend Certified Engineer
http://www.corephp.co.uk
"Never trust a computer you can't throw out of a window"
.
- Follow-Ups:
- Re: [PHP] Return or not to return, that is the question
- From: "Richard Lynch"
- Re: [PHP] Return or not to return, that is the question
- From: Zoltán Németh
- RE: [PHP] Return or not to return, that is the question
- From: "Edward Kay"
- Re: Return or not to return, that is the question
- From: "M. Sokolewicz"
- Re: [PHP] Return or not to return, that is the question
- Prev by Date: Can anybody explain why this accented character routine works?
- Next by Date: Re: [PHP] php via cmdline including unwanted headers
- Previous by thread: Can anybody explain why this accented character routine works?
- Next by thread: Re: Return or not to return, that is the question
- Index(es):
Relevant Pages
|