Richard Davey wrote:
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
In such cases it depends on the project I'm working on. If it's a
slightly bigger project which will see future development, I usually
stick to a return true|false policy even though such functions don't
have a meaningful return (YET!), as this might change later.
If it's a project which will be used but probably won't see any
extensive future development, I generally tend to not return anything.
- Tul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php