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

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

 



On Wed, 2007-05-30 at 17:24 +0100, Richard Davey wrote:
> Hi Jared,
> 
> Wednesday, May 30, 2007, 4:10:45 PM, you wrote:
> 
> [snip]
> > I think putting "return;" at the end of every function is probably a healthy
> > practice, but is it best practice? If it's poorly written and/or poorly
> > factored code, it doesn't make any difference if they have returns on
> > everything, it's still junky code.
> 
> If you do put a return; at the end of all of your functions, I'm
> curious as to why? If a function doesn't actually return a value
> (which is highly possible) then it isn't /required/, but that doesn't
> stop me from doing it. I *do* put 'return;' at the end of all
> functions (my question to the list was - does anyone else?)

If there's no reason for it to return something, why bother? It's like
telling the reader of your code that they're a complete and utter moron
because obviously you need to point out explicitly that the code returns
at that point because they obviously couldn't infer it from having
reached the end of the function :) 

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

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