switch-case statement without break

后端 未结 7 1677
鱼传尺愫
鱼传尺愫 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 02:12

    The break acts like a goto command. Or, as a better example, it is like when using return in a void function. Since it is at the end, it makes no difference whether it is there or not. Although, I do like to include it.

    0 讨论(0)
提交回复
热议问题