cs1513错误,我该如何解决? [英] cs1513 error, how do i fix it?

查看:397
本文介绍了cs1513错误,我该如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cosole.WriteLine("选择门1,2或3");

Cosole.WriteLine(" pick a door 1,2 or 3");

字符串userValue;

String userValue;

userValue = Console.ReadLine();

userValue= Console.ReadLine();

If(userValue ==" 1");

If (userValue=="1");

{

Console.WriteLine("你赢了一辆车");

Console.WriteLine("you won a car");

Console.ReadLine();

Console.ReadLine();

}

否则if(userValue ==" 2")~~~如果我输入其他内容就会出现问题

else if (userValue=="2")~~~the problem occurs as soon as I type in else if

推荐答案

'if'语句的条件表达式与其后的正文之间没有分号:

There is no semi-colon between the conditional expression of the 'if' statement and the body after it:

If (userValue=="1")  // << No semi-colon here
{
Console.WriteLine("you won a car");
Console.ReadLine();
}
else if (userValue=="2")
{
  // other stuff
}


这篇关于cs1513错误,我该如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆