c# loop until Console.ReadLine = 'y' or 'n'
I'm fairly new to c#, and writing a simple console app as practice. I want the application to ask a question, and only progress to the next piece of code when the user input equals 'y' or 'n'. Here's what I have so far. static void Main(string[] args) { string userInput; do { Console.WriteLine("Type something: "); userInput = Console.ReadLine(); } while (string.IsNullOrEmpty(userInput)); Console.WriteLine("You typed " + userInput); Console.ReadLine(); string wantCount; do { Console.WriteLine("Do you want me to count the characters present? Yes (y) or No (n): "); wantCount = Console.ReadLine();