我不知道爲什麼我得到這個以下錯誤:C#切換貫穿錯誤?
Control cannot fall through from one case label ('case "h":') to another (CS0163)
僅適用於H和S - 很奇怪。
switch(myChoice)
{
case "K":
case "k":
Console.WriteLine("You have chosen the Kanto region");
break;
case "O":
case "o":
Console.WriteLine("You have chosen the Orange Islands");
break;
case "J":
case "j":
Console.WriteLine("You have chosen the Johto region");
break;
case "H":
case "h":
Console.WriteLine("You have chosen the Hoenn region");
case "S":
case "s":
Console.WriteLine("You have chosen the Sinoh region");
case "U":
case "u":
Console.WriteLine("You have chosen the Unova region");
break;
case "R":
case "r":
Console.WriteLine("Return");
break;
default:
Console.WriteLine("{0} is not a valid choice", myChoice);
break;
}
只是站起來:你現在問了三個問題,現在有一個可以接受的答案。您應該通過點擊答案旁邊的複選標記來接受這些答案。 –
哦天哪謝謝><,我從來不知道那個 –