break in a case with return.. and for default

前端 未结 13 2097
予麋鹿
予麋鹿 2020-12-11 14:19

My OCD makes me add \"break\" when writing case statements, even if they will not be executed. Consider the following code example:

switch(option) {
    cas         


        
13条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-11 15:09

    You don't need either break, but there's no harm in having them. In my opinion, keeping your code structured is worth having a couple of extraneous statements.

提交回复
热议问题