0
我剛剛學習C#,並試圖製作一個簡單的終端遊戲。所以,當我試圖編譯它時,它會給出6個錯誤。編譯C#代碼時出現很多錯誤
的代碼是:
{
Console.WriteLine("Hello, what is your name? : ");
string name = Console.ReadLine(); //Lets you enter the name
Console.WriteLine($"Hello, {name}! What should I do? \n Type help for list of commands);
Console.ReadKey();
string command = Console.ReadLine();
if(command == "help")
Console.WriteLine("The only command for now is \"Market\"");
else if(command == "Market")
Console.WriteLine("You're now at the market");
else
Console.WriteLine("Sorry, I didn't understand you!");
Console.ReadKey();
}
這裏就是終端說一下吧:
ReadLine.cs(24,70): error CS1525: Unexpected symbol `The'
ReadLine.cs(24,100): error CS1056: Unexpected character `\0022'
ReadLine.cs(24,102): error CS1056: Unexpected character `\0022'
ReadLine.cs(24,105): error CS1010: Newline in constant
ReadLine.cs(26,39): error CS1525: Unexpected symbol `)'
ReadLine.cs(29,12): error CS1525: Unexpected symbol `else'
並添加到@doctorlove所說的...通常,單個錯誤會產生多個錯誤。修復一個,所有(或許多)都會消失。 –