Re: Conceptual problem solved by GOTO

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

Andy Serpa wrote:
> 
>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. 

Although v4.0 will not have "exit(x)" it does have "exit <label>" where <label>
is the name given to a loop. For example:

    while conda label "A" do
        --- stuff ---
        while condb label "B" do
            --- stuff
            if condc then
                exit "A" -- Exits the loop called 'A'
            end if
            -- stuff --
        end while
        -- stuff --
    end while
 

        

>A "continue" or "skip" would also be nice for loops, allowing
> you to jump ahead to the next iteration immediately.

Version 4.0 has a 'continue' statement now. It causes control to immediately
continue with the next iteration. It also can have an optional label name.


There is also a 'retry' statement that causes control to immediately repeat the
same iteration. This will be more useful when exception handling makes to
Euphoria one day.


-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

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

Search



Quick Links

User menu

Not signed in.

Misc Menu