Re: New switch/case idea

new topic     » goto parent     » topic index » view thread      » older message » newer message
Fernando said...

Does that mean the meaning of break depends on context ?

Yes, just like exit or continue or retry (the last two are new in 4.0). This is to prevent having to invent extra flags and create extremely convoluted control flow:

integer exit_i = 0 
for i = 1 to 10 do 
    for j = 1 to 10 do 
        if foo(j) > bar(i) then 
            exit_i = 1 
            exit 
        end if 
    end for 
    if exit_i then 
        exit 
    end if 
end for 

That code could (in 4.0) be simplified:

for i = 1 to 10 label "i" do 
    for j = 1 to 10 do 
        if foo(j) > bar(i) then 
            exit "i" 
        end if 
    end for 
end for 

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu