loop do .. until end loop is surely incorrect!

new topic     » topic index » view thread      » older message » newer message
loop do  
  integer x = 3  
  until x = 3  
end loop  

According to the manual this is correct.

It does NOT compile. version 4.0.0 on linux (slackware 13.1).

The reverse of this is not:

while x = 3 do 
  integer x = 3 
end while 

but rather something like:

if TRUE then 
  integer x = 0 
  while x = 3 do 
    integer x = 3 
  end while 
end if 

That is to say that it should compile, and the reason it doesn't has probably due to its being seen as a variation on a while loop - (but there the test comes after the end loop).

I do not like the loop scoping rules in Euphoria because they depend on syntax: where the loop ends, when the dynamics would indicate that the scope should be from declaration to the exit from the loop.

This ambiguity is problematic: eg.

while TRUE with entry do 
  integer x = 3 
entry 
  ? x 
end while 

will compile but not run because x has on value on the 1st iteration.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu