break in a case with return.. and for default

前端 未结 13 2092
予麋鹿
予麋鹿 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条回答
  •  无人及你
    2020-12-11 15:17

    I would put the break in to show that you do not intend to fall through to next case.

提交回复
热议问题