<分区>
我是第一次参加计算机类(class)的学生,多年来我一直试图“破解”这门类(class)(我对此很陌生……抱歉!)。我似乎无法构建一个简单的 if/else 语句,如果满足条件,它会写一个肯定的响应,如果不满足,则写一个否定的响应。但我收到错误:
无效的表达式术语“else”
只有assignment、call、increment、decrement、new对象表达式才能作为语句使用
抱歉,如果这没有意义,我很困惑! :(
static void Main(string[] args)
{
Console.WriteLine("Do you like bananas?");
Console.ReadLine();
if (Console.ReadLine() == "Yes") ;
{
Console.WriteLine("Thanks for your time!");
}
else;
{
Console.WriteLine("Oh okay.");
}
}
}