1. continue

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

-- 
Linux User:190064
Linux Machine:84163
http://jbrown105.1avenue.com

new topic     » topic index » view message » categorize

2. Re: continue

>
> 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 message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu