开发者

Error 2 Invalid expression term ')'

开发者 https://www.devze.com 2023-02-18 22:10 出处:网络
I\'m new to c# more experienced with c++ so heres my code Did i forget to add something i don\'t think i did if i did id thank for a response! :)

I'm new to c# more experienced with c++ so heres my code Did i forget to add something i don't think i did if i did id thank for a response! :)

Note:I have read the similar questions but did not understand the answers well the program is personal venture into a new language.

Code:

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("Inp开发者_开发知识库ut a NON capital y or n when told to.");


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

            if()
            {}
        }
    }
}

Thanks for your answers!


You can't have an empty if(). The compiler tells you it expects an expression before the closing paren.


The error is pointing to the empty parens in the "if () {}" --there must be a boolean expression inside the parentheses.

0

精彩评论

暂无评论...
验证码 换一张
取 消