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.

We have a much better method already implemented called labeled loops. It was
discussed here quite a bit. General:

for a = 1 to length(lines) label "line_it" do
    line = lines[a]
    if match("/*", line) then
        while 1 do  --- we are going to eat all comment lines.
            -- read line
            -- test end of comment?
            if end_of_file then
                 exit "line_it"
            end if
        end while
    end if
end for


--
Jeremy Cowgar
http://jeremy.cowgar.com

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

Search



Quick Links

User menu

Not signed in.

Misc Menu