Evaluate Expressions in Switch Statements in C#

前端 未结 12 687
抹茶落季
抹茶落季 2021-01-31 01:42

I have to implement the following in a switch statement:

switch(num)
{
  case 4:
    // some code ;
    break;
  case 3:
    // some code ;
    brea         


        
12条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-31 02:03

    You could do something like this at the end of your switch statement:

    default:
        if(num < 0)
        {
            ... // Code
        }
        break;
    

提交回复
热议问题