using System;
namespace HelloWorld
{
class MainClass
{
// Entry Point For Program
public static void Main(string[] args)
{
Console.WriteLine("Enter your name:");
String Name = Console.ReadLine();
Console.WriteLine($"Thank you, so your name is {Name}?:");
if (Console.ReadLine() == "Yes" || Console.ReadLine() == "yes")
{
Console.WriteLine($"So I will be calling you {Name}");
}
if(Console.ReadLine() == "No" || Console.ReadLine() == "no")
{
Console.WriteLine("Then Enter your Name again:");
String Name2 = Console.ReadLine();
Console.WriteLine($"So your name this time is {Name}");
}
}
}
}
So I want to be able to type in either Yes/yes or No/no but it only detects the Yes/yes first so i have to say yes and i can’t say No/no
Store the result of Console.ReadLine() after asking to confirm the name in a variable. Then use that variable to compare to “Yes” and “No”.