📜  c# switch case 大于 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:15.705000             🧑  作者: Mango

代码示例1
int mark = 50;
switch (mark)
{
    case int n when n >= 80:
        Console.WriteLine("Grade is A");
        break;

    case int n when n >= 60:
        Console.WriteLine("Grade is B");
        break;

    case int n when n >= 40:
        Console.WriteLine("Grade is C");
        break;

    default:
        Console.WriteLine("Grade is D");
        break;
}