Re: Goto, etc.

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

I've see this sort of thing before. However, it creates an opportunity for
bugs to creep in, because if you ever change the nesting levels, you have
to review every "exit" integer to make sure its still the right number.

eg. Original Code...
for i=1 to 10 do
    for j=5 to 25 by 5 do
        while k<75 do
            if error1 then exit  end if -- or exit 1
            if error2 then exit 2 end if
            if error3 then exit 3 end if
        end while
    end for
end for

eg. Modified Code...
for i=1 to 10 do
  for z=1 to 3 do
     ...
    for j=5 to 25 by 5 do
        while k<75 do
            if error1 then exit 2 end if <<<Must Change
            if error2 then exit 3 end if <<<Must Change
            if error3 then exit 4 end if <<<Must Change
        end while
    end for
  end for
end for


cheers,
Derek Parnell
Melbourne, Australia

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

Search



Quick Links

User menu

Not signed in.

Misc Menu