Re: Some questions about the languages
- Posted by CChris Jul 17, 2008
- 952 views
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