Re: Changes to Euphoria

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

ken mortenson wrote:
> 
> Loop
>    ...
> End Loop

This is a cool idea. All our loop constructs can be replaced by one simple

Loop

End Loop

Loop [from x by y] -- default is from 1 by 1 and optional
  -- put code here to emulate "for" loop
  if Loop = 10 then exit end if 
  -- code here for "while" loops
End Loop

(Can Loop have this dual purpose, to start a Loop AND be its counter?)

So, instead of

for i=1 to 20 do
  ...code
end for

we do

Loop
  ...code
  if Loop = 20 then exit end if
End Loop

Instead of

q = x
while atom(q) do
  ...code
  q = x
end while

q = x
Loop
  if atom(q) then exit end if
  ...code
  q = x
End Loop

Loop..End Loop is a teensie bit more verbose, but it minimalizes the strain
on my brain... one loop construct instead of 2+.

This was just a fun thought experiment. Please don't claim that I'm adding
Loop to Euphoria. 8)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu