break in a case with return.. and for default

前端 未结 13 2072
予麋鹿
予麋鹿 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:13

    The break after your default case is just a matter of personal preference.

    Putting a break after return almost seems contradictory to me. I'd remove the break, just to make the return statement really stand out.

提交回复
热议问题