當我在沒有goto命令的情況下執行代碼時,它可以工作,但是當我添加:Start
時,它會得到一個8錯誤。goto命令不起作用
下面是相關代碼:
:Start
Console.Write("Do you want the yes or no?");
string what = Console.ReadLine();
switch (what)
{
case "yes":
Console.WriteLine("You choose yes");
break;
case "no":
Console.WriteLine("You choose no");
break;
default:
Console.WriteLine("{0},is not a word",what);
goto Start;
}
轉到哪種語言? – 2014-10-31 15:12:47
正確的標籤語法:'開始:' – 2014-10-31 15:14:44
請不要太習慣goto語句:https://www.cs.utexas.edu/users/EWD/ewd02xx/EWD215.PDF:D – SlySherZ 2014-10-31 15:15:58