On 10/10/2012 2:36 PM, Tim Streater wrote:
On 10 Oct 2012 at 19:17, David McGlone <da...@dmcentral.net> wrote:

BTW - in any of your other computer languages didn't they utilize a
'return' statement?  PHP's is no different.

back in  like '85, I learned Pascal that's the only language I learned and I
don't recall if it used return.

Mmmm. There's the problem. Pascal doesn't *have* a return statement. In Pascal, 
implicitly, you return when execution reaches the end of a function. In fact 
the same is true of PHP and JavaScript, but in those languages you can return 
early just by saying return.

IMO, this is a major limitation of Pascal. I use returns wherever I feel like 
it - if I detect there's nothing more for the function to do, I return. Purists 
object to this; they say you should enter a function at one place and leave at 
one place. Well, that's a point of view. But more often that not it just leads 
to convoluted code in order to achieve that. The one time I *had* to use Pascal 
as that was the only option, I simply put a 999: label at the end of the 
function and did goto 999 wherever I wanted to do a return. Simples!

Cheers  --  Tim

Now you went and gave our OP something else to think about!  :(:(

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to