不使用“刹车”语句重制代码[关闭]

问题描述 投票:0回答:0

如何在不使用

brake
的情况下重写这段代码?

我有密码:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 

public class Exercise23
{
    static void Main(string[] args)
    {
        string notes;
        char grade;

        Console.Write("Input your value :");

        grade = Convert.ToChar(Console.ReadLine());

        switch (grade)
        {
            case 'E':
                notes = " Excellent";
                break;
            case 'V': 
                notes = " Very Good"; 
                break;
            case 'G':
                notes = " Good ";
                break;
            case 'A':
                notes = " Average";
                break;
            case 'F':
                notes = " Fails";
                break;
            default:
                notes = "Invalid Value";
                break;
        }

        Console.Write("Your chose is : {0}\n", notes);
    }
}

我很好奇在每个

brake
之后看到不写
case
的选项。 而且我真的不知道该怎么做。

c# switch-statement break
© www.soinside.com 2019 - 2024. All rights reserved.