Re: Conceptual problem solved by GOTO

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

Andy Serpa wrote:
> 
> Although I vote NO on general goto, I do vote yes on "exit(x)" whereby x in
> an integer allowing you to break out of x many nested loops, which avoids the
> use of flags, etc.  A "continue" or "skip" would also be nice for loops,
> allowing
> you to jump ahead to the next iteration immediately.
> 
> These could be seen as specific cases of goto, but I still vote NO on general
> goto.

I don't like that at all.

for index1 = 1 to 10 do
  for index2 = 1 to 10 do
    if (condition) then
      exit(2)
    end if
  end for
end for
--exit(2) was here.

for index1 = 1 to 10 do
  for index3 = 1 to 15 do
    for index2 = 1 to 10 do
      if (condition) then
        exit(2)
      end if
    end for
  end for
  --exit(2) is now here
end for
--exit(2) was here.

t.

A reasonable change to the code changed the exit point.
exit label makes more sense.

    Lucius L. Hilley III - Unkmar

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

Search



Quick Links

User menu

Not signed in.

Misc Menu