Re: New keyword added: continue

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

Kat wrote:
> Bare-bones basic stuff. But getting good loops (if-then, while-do,
> repeat-until<cough>)
> in modern languages, and then adding 4 or more keywords to jump around
> *inside*
> a loop smells like nuts to me.

A programmer after my own heart (soon you will achieve oneness...)

I'm even weirder in my thinking (you guys already figured that one out didn't
ya?  But here's some confirmation...)

All code written anywhere by anyone (quantum computing may make this statement
untrue) have only three structures (sequence, branch, loop)

I'd like to get rid of ALL the various flavors of loops
(while, for, for each, etc.) and replace it with the pseudo code I've
always used.

Loop
  ...
End Loop

You do all your initialization before the loop.  The loop creates Index
which starts with a value of zero and increments once each iteration.

The scope of Index is limited to the last declaration so for nested loops...

Loop
  x = Index
  Loop
    y = Index
    array(x,y)=whatever.
    if (y>9) exit
  End Loop
  if (x>12) exit
End Loop

...but I'm a dreamer.  Am I not the only one?

Note that all loops are infinite and require an explicit exit.  Programmers
with bad habits will be spanked enough to learn good habits in very
short order.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu