Re: New switch/case idea

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

OK, one more question. Without specifying "with fallthru" - i.e: using the defaults - then only the matching case will be executed, with or without a break being in there, is this correct? break can be left out?

This is perhaps a good time to provide a link to the docs for switch.

Matt

switch <expr> [with fallthru] [label "<label name>"] do  
    case <val1>[, val2,...] then  
        [code block 1]  
        [break]  
    case <val2>[,...] then  
        [code block 2]  
        [break]  
    case <val3>[, ...]:  
        [code block 3]  
        [break]  
    ...  
  
    [case else]  
        [code block 4]  
        [break]  
end switch  
  • It doesn't have the optional label with break in the syntax of switch statement;
  • It's possible to have break inside any code block;
  • Note the colon in case <val3>[, ...]:

-Fernando

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

Search



Quick Links

User menu

Not signed in.

Misc Menu