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

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

代码示例6
scale = exponent switch
        {
            int n when (n >= 6 && n < 9) => "Million",
            int n when (n >= 9 && n < 12) => "Billion",
            int n when (n >= 12 && n < 15) => "Trillion",
            int n when (n >= 15 && n < 18) => "Quadrillion",
            int n when (n >= 18 && n < 21) => "Quintillion",
            int n when (n >= 21 && n < 24) => "Sextillion",
            int n when (n >= 24 && n < 27) => "Septillion",
            int n when (n >= 27 && n < 30) => "Octillion",
            30 => "Nonillion",
            _ => "",
        };