Re: New switch/case idea

new topic     » goto parent     » topic index » view thread      » older message » newer message
Fernando said...
DerekParnell 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?

Yes. "break" is optional if you do not have "with fallthru". If you use it, it has no effect because you don't fall through anyway.

If the break is not the last statement of the case and if it works as in C language, then break has an effect: it aborts the switch statement immediately.

- Fernando

That should still work in Euphoria too, but it doesn't at the moment. I think this is a bug. To get it to work currently you have to add a label to the break clause...

  switch X label "A" do 
      case 1 then 
      . . . 
         if cond then 
             break "A" 
         end if 

</eucode>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu