完成 switch
语句,并在末尾添加正确的关键字,以指定在 switch
语句中没有 case 匹配时要运行的代码。
int day = 3; switch (@(3)) { @(4) 1: Console.WriteLine("Today is Saturday"); break; @(4) 2: Console.WriteLine("Today is Sunday"); @(5); @(7): Console.WriteLine("Looking forward to the Weekend"); @(5); }
int day = 3; switch (day) { case 1: Console.WriteLine("Today is Saturday"); break; case 2: Console.WriteLine("Today is Sunday"); break; default: Console.WriteLine("Looking forward to the Weekend"); break; }