using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SwitchCase
{
class Program
{
static void Main(string[] args)
{
int i = 1;
switch (i)
{
//这里的case 1:后面没有break就表示它可以继续执行下去 从而实现了if(i == 1 || i == 2)的条件
case 1 :
case 2: Console.WriteLine("你选择了1或者2");
break;
case 3: Console.WriteLine("你选择了3");
break;
default: Console.WriteLine("传进来的{0}没有意义!", i);
break;
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SwitchCase
{
class Program
{
static void Main(string[] args)
{
int i = 1;
switch (i)
{
//这里的case 1:后面没有break就表示它可以继续执行下去 从而实现了if(i == 1 || i == 2)的条件
case 1 :
case 2: Console.WriteLine("你选择了1或者2");
break;
case 3: Console.WriteLine("你选择了3");
break;
default: Console.WriteLine("传进来的{0}没有意义!", i);
break;
}
}
}
}