Re: New keyword added: continue

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jeremy Cowgar wrote:

> I was thinking we have:
> 
> loop do
> 
> until ... 
> 
> Why not
> 
> loop do
> ...
> again or repeat
> 
> However, I'd use a while loop or until loop for examples such as if (x>12)
> exit. 

The only difference between a do while or do until is where the test is made.
In my construct there is no difference, you just put it where you want (or
at multiple points if that's your style or need.

do, again and repeat are all extraneous.  In my view all structures
would consistantly end with end (followed by the name of the structure:
if, loop, procedure, etc.)

Also you are assigning y = Index, x = Index, therefore, those are probably
> being incremented somewhere that you are not showing making the above loop
> probably
> more suited to a for loop?

Exactly, they are incremented under the covers for each iteration of the loop
starting at zero.  This doesn't mean the programmer is limited in any way.

A for loop simply has it's initialize as part of it's syntax.  Initialize
before the loop in all cases creates a simple habit.  It may even teach
those that initialize IN loops that, that is not a good idea.

For loops also have an implicit increment by which I'm just suggesting is
better being explicit.

The real advantage is only one loop structure wich reduces stress on the
humble programmer.  Need a loop?  Use Loop.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu