Re: with entry and goto statement

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

I learned to program in the '70s using Pascal and learned all about the evils of the GOTO statement.

While I can understand that people don't like to use "I'm done" type tests, I'm still not completely comfortable with break commands because they sometimes seem ambiguous. Off the top of my head I'm going to try some bogus code to try to point to some possible confusion with break statements.

while condition1 do 
  if condition2 then break 
  for 1 to 100 do 
    if condition3 then break 
    while condition4 do 
      if condition5 then break 
    end while 
    if condition6 then break 
  end for 
  if condition7 then break 
end while 

Do all of these break to the end of the innermost loop construct it is within? This would mean that breaking on condition3 or condition6 would jump to the end of the for loop and breaking on either condition2 or condition7 would jump to the end of the outer while loop.

What if I want to break to the end of the outer while loop on condition5? Are there loop labels for identifying which loop construct is being broken out of? For instance, could I label the outer while loop as OuterW and then break to OuterW from anywhere within the while's code regardless of what other looping I might be doing within the while loop?

I've used Euphoria just for fun (see my JoKoSoKo game) and haven't yet tried it with the newly released version (though I do have it working with a beta version, so I assume that it should not need much if any mods to work with the public release). Maybe these concerns are addressed and I just haven't looked at the manual enough to recognize it.

I appreciate all of the hard work done by the people supporting Euphoria and look forward to continuing to use it. I'm thinking of trying to rewrite my game using wxWindows (I think that's what I've seen referred to) instead of Win32Lib so that I could have it available for both Windows and Linux.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu