在C#中有没有其他人有这个问题? [英] Does any one else have this problem in C#?
本文介绍了在C#中有没有其他人有这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在C#中创建一个if else语句,但我无法运行代码,因为错误消息显示它预期}。以下是代码:
静态 void Main( string [] args)
{
string 密码;
Console.WriteLine( 什么是密码?);
密码= Console.ReadLine();
if (密码== seeharp);
{
Console.WriteLine( 欢迎回来Chris);
} // 这就是说它需要的地方}。
< span class =code-keyword> else
{
}
}
}
}
我尝试过的事情:
我试过把其他声明遍布整个地方。什么都没有。
解决方案
尝试删除';':
if (密码== seesharp)
I'm trying to make an if else statement in C#, but I can't run the code because the error message says that it expects }. Here is the code:
static void Main(string[] args)
{
string Password;
Console.WriteLine("What is the password?");
Password = Console.ReadLine();
if (Password == "seesharp") ;
{
Console.WriteLine("Welcome back Chris");
}//Here is where is says it expects a }.
else
{
}
}
}
}
What I have tried:
I've tried putting the else statement all over the place. Nothing.
解决方案
Try to remove the ';' :
if (Password == "seesharp")
这篇关于在C#中有没有其他人有这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文