小编Sta*_*kov的帖子

编译C#代码时出现许多错误

我只是学习C#而且我试图制作一个简单的终端游戏.所以,当我尝试编译它时,它会发出6个错误.

代码是:

{
    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();
}
Run Code Online (Sandbox Code Playgroud)

这就是终端所说的:

ReadLine.cs(24,70): error CS1525: Unexpected symbol `The'
ReadLine.cs(24,100): error CS1056: Unexpected character `\0022'
ReadLine.cs(24,102): error CS1056: …
Run Code Online (Sandbox Code Playgroud)

c#

0
推荐指数
1
解决办法
95
查看次数

标签 统计

c# ×1