Re: Anyone done anything with the Euphoria Source Code?

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

What about an 'exit' sort of proc, but one that can take a parameter..

eg...

function check(atom a, atom b, atom c)
  return something
end function

for x = 1 to 100 do
  for y = 1 to 100 do
      for z = 100 do
        if check(x,y,z) then
        exit(3)
      end for
  end for
end for

So it would get out of all loops if check returned positive. The only way to 
do that right now is put the loop in a proc, and call return, or use lots of 
boolean flags.... not fun.
>guess i agree, but to be more versatile, lets have the "continue" >pecify
>here to continue to, to get out of deeply nested loops, without lots >of 
>flow
>control flag setting and testing,,, rather like this (and notice how >each
>section is nicely blocked out with comment-like tags for the continue()
>statement!) :
>
>procedure demo_continue()
>for ...
>--code

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

Search



Quick Links

User menu

Not signed in.

Misc Menu