Re: Re: limiting

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

 



On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote:
> On 10 Oct 2012 at 19:17, David McGlone <david@xxxxxxxxxxxxx> 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!

goto was the thing that got on my nerves. Even to this day I hate that word 
with a passion.
 

-- 
David M.


[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