我不斷收到一個錯誤CS1513在下面的代碼在視覺工作室寫在C#CS1513錯誤}預期
{
class NotChineseZodiac
{
static void Main(string[] args)
{
String YearBorn;
int YearBornInt;
Console.WriteLine("What was the year of your birth?");
YearBorn = Console.ReadLine();
YearBornInt = Convert.ToInt32(YearBorn);
Console.WriteLine("You are" + (DateTime.Now.Year - YearBornInt));
if ((DateTime.Now.Year - YearBornInt) < 18);
Console.WriteLine("You Shall Not PASS");
else
Console.WriteLine("Please Proceed");
Console.ReadLine(); // last enter key
有誰看到我的錯誤?
空間是不允許的,如果其他人之間。 –
yes..remove end end here if((DateTime.Now.Year - YearBornInt)<18);' – Pikoh
@ m.kudi你可以在'if'和'else'之間有空行或註釋行,但你不能在它們之間有多於一個的代碼塊,在這裏就是這種情況。 – juharr