dimanche 4 avril 2021

Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement C#

stack overflow users! I am stuck at this piece of code in C#. Its an if statement.

            Console.WriteLine("Enter your gender : ");
            var gender = Console.ReadLine();
            if(gender == "boy"){
                Boy.gender == "boy"; // < error here
            }

The problem states in Vscode is

Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement 

and this error is pointing at the if statement. I'm pretty new in C# so I don't understand this. Any help is appreaciated <3

Aucun commentaire:

Enregistrer un commentaire