9

Somehow, a continue instead of break in a switch-case looks weird. Although it makes perfectly sense with regard to the outer for loop.

Comments
  • 0
    @rutee07 #define proceed continue
  • 1
    Doesn't make sense to me.
    Can u show a snippet?
  • 0
    I always thought it would be a great way to make state machines if you had switch(state) and continue would jump back to switch
  • 0
  • 0
    @Pyjong that wouldn't be great because switch isn't supposed to be a loopy construct. However, you can easily achieve the desired behaviour with a surrounding loop.
  • 0
    @Fast-Nop that would be great! If you dont want to loop use break instead. But yeah can be done with surrounding while.
  • 0
    @Pyjong no it would be horrible because switch isn't a loop and therefore doesn't have a header/footer where the loop termination condition is checked.

    What you are suggesting would be a goto right before the start of the switch, and that kind of goto use gives awful spaghetti code. You just don't use goto to jump backwards in algorithmic flow.
  • 0
    @Fast-Nop well if you insist on using it wrong, then there is nothing to talk about.. peace üt
Add Comment