簡體   English   中英

錯誤2無效的表達式術語')'

[英]Error 2 Invalid expression term ')'

我是C#的新手,對C ++經驗比較豐富,所以這里提供了我的代碼我是否忘記添加一些我認為沒有的東西,如果我沒有id,我感謝您的答復! :)

注意:我已經閱讀了類似的問題,但對答案的理解不佳。

碼:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Input_Program
{
    class Program
    {
       private static void Main()
        {

           Console.WriteLine("Welcome to my bool program!");
           Console.WriteLine("Input a NON capital y or n when told to.");


            char Y = 'y';
            char N = 'n';

            if()
            {}
        }
    }
}

感謝您的回答!

您不能有一個空的if() 編譯器告訴您期望在結束括號之前有一個表達式。

錯誤指向“ if(){}”中的空括號-括號內必須有一個布爾表達式。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM