
-----------------------------------
Tallguy
Wed Apr 30, 2008 8:30 am

Multiply Exiting
-----------------------------------
How does one exit out of multiply loops (nested loops)once a statement is true.

-----------------------------------
Tony
Wed Apr 30, 2008 9:31 am

RE:Multiply Exiting
-----------------------------------
you can place the entire structure into a function and return out of that, or use multiple exit when statements

loop
   put "start outter loop"
   loop
      put "start inner loop"
      exit when true
      put "inner loop skipped"
   end loop
   exit when true
   put "outer loop skipped"
end loop
put "done!"


-----------------------------------
darkangel
Wed Apr 30, 2008 3:33 pm

Re: Multiply Exiting
-----------------------------------

you can place the entire structure into a function and return out of that, or use multiple exit when statements

loop
   put "start outter loop"
   loop
      put "start inner loop"
      exit when true
      put "inner loop skipped"
   end loop
   exit when true
   put "outer loop skipped"
end loop
put "done!"


Is there any other way thats more efficient? When you have 3 or 4 procedures and most have nested loops it can get crowded very quickly with all the "exit when"'s

-----------------------------------
Nick
Wed Apr 30, 2008 3:37 pm

RE:Multiply Exiting
-----------------------------------
return

-----------------------------------
darkangel
Wed Apr 30, 2008 4:02 pm

Re: RE:Multiply Exiting
-----------------------------------
return
Its sad that i forgot this even thou i posted this exact syntax not 15 minutes ago
