Switch statement inside a switch statement?

前端 未结 8 1798
傲寒
傲寒 2021-02-07 02:40

I have to evaluate many conditions. In my case, I have to do something like this:

switch(id)
{
    case 5:
         // switch some other cases here
    case 6:
          


        
8条回答
  •  孤独总比滥情好
    2021-02-07 03:35

    Switch statements aren't bad practice. Nested switch statements might be messy to look at.

    Perhaps think about embedding the nested switch statement in another method to improve clarity.

提交回复
热议问题