1. Euphoria For Loop Question

Hi all,

Does Euphoria have a equivalent of C's for loop

for (;;) 
{ 
 //do stuff 
} 

new topic     » topic index » view message » categorize

2. Re: Euphoria For Loop Question

The closest would probably be

while 1 do 
  -- something useful 
end while 
new topic     » goto parent     » topic index » view message » categorize

3. Re: Euphoria For Loop Question

axtens_bruce said...

The closest would probably be

while 1 do 
  -- something useful 
end while 

I guess that would probably work for most things.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Euphoria For Loop Question

loop do 
  ... 
end loop 

https://openeuphoria.org/docs/lang_loop.html

new topic     » goto parent     » topic index » view message » categorize

5. Re: Euphoria For Loop Question

mitgedanken said...
loop do 
  ... 
end loop 

No, it complains about a lack of until.

-Bruce

new topic     » goto parent     » topic index » view message » categorize

6. Re: Euphoria For Loop Question

mitgedanken said...
loop do 
  ... 
end loop 

This may end with something like this:

<0132>:: Syntax error - expected to see possibly 'until', not 'end' 
end loop 
   ^ 

Maybe, according to the documtation, more like this

atom endofdays=0 
loop do 
    -- something useful  
    until endofdays 
end loop 
new topic     » goto parent     » topic index » view message » categorize

7. Re: Euphoria For Loop Question

andreasWagner said...

Maybe, according to the documtation, more like this

atom endofdays=0 
loop do 
    -- something useful  
    until endofdays 
end loop 

I haven't tested it, but I expect until 0 would be fine. Just so you know, Phix does not have the loop keyword, but also allows

do 
   ... 
until false 
new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu