switch-case statement without break

后端 未结 7 1697
鱼传尺愫
鱼传尺愫 2021-02-04 01:44

According to this book I am reading:

Q What happens if I omit a break in a switch-case statement?

A The break statement enables program execution to exit the swi

7条回答
  •  时光取名叫无心
    2021-02-04 01:52

    You execute everything starting from the selected case up until you see a break or the switch statement ends. So it might be that only C is executed, or B and then C, or A and B and C, but never A and C

提交回复
热议问题