Re: Some questions about the languages

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

I don't understand the label part or how to use it. Nothing in the docs explains it. The example doesn't use it.

switch <expr> [label "<label name>"] do

See the section about "labelled headers". if, switch, while, for and loop all may have a label into the header, which some control flow instructions can use.

Like in

while 1 label "top_ loop" do 
  -- something 
  for idx = 1 to whatever do 
    if something_happened() then 
      exit "top loop" -- this gets out of the while loop with that label 
                      -- you could also say exit 2 or exit 0, but they are less easy to maintain. 
                      -- you cannot use anything variable here 
    end if 
  end for 
end while 

CChris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu