I am a junior programmer and I think that I'm making a stupid mistake in C#
Console.WriteLine("What do you call a line of people who want to punch you?");
string answer = ("The punch line");
Console.ReadLine();
if (Console.ReadLine(answer))
{
Console.WriteLine("correct");
}
CodePudding user response:
string input = Console.ReadLine();
if (input.Equals(answer))
{
Console.WriteLine("correct");
}
Save the user input to a variable and compare that to the answer string.
CodePudding user response:
You aren't checking the user's input. Try this:
Console.WriteLine("What do you call a line of people who want to punch you?");
string answer = ("The punch line");
string input = Console.ReadLine();
if (answer == input)
{
Console.WriteLine("correct");
}