Re: continue

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

>
> continue can be emulated as so:
>
> for i = 1 to 10 do
> while 1 do --need second loop
> if i = 5 then
> exit --skip 5
> end if
> ? i
> exit --always run the second loop only once
> end while
> end for

This is how I emulate continue too.

---
integer Continuing

Continuing = 1
while Continuing do
    Continuing = 0
    -- here's the real loop
    while whatever do
       <do something>
       if <test for continuance> then
          Continuing = 1
          exit
       end if
       <do something else>
    end while
end while

---

unfortunately goto cannot be so easily emulated without massive code
reorganisation.

------
Cheers,
Derek

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

Search



Quick Links

User menu

Not signed in.

Misc Menu