How to do a case with multiple conditions?

后端 未结 5 639
傲寒
傲寒 2020-12-29 21:57

In the 1 month experience I\'ve had with any programming language, I\'ve assumed that switch case conditions would accept anything in the parenthes

5条回答
  •  旧巷少年郎
    2020-12-29 22:36

    You can do -

    switch(c) {
        case 'W':
        case 'w': //your code which will satisfy both cases
                  break;
    
        // ....
    }
    

提交回复
热议问题