title: c# loop until Console.ReadLine = 'y' or 'n'
body: <p>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.</p>
  <pre><code>static void Main(string[] args)
  {
  
      string userInput;
      do
      {
          Console.WriteLine(&quot;Type something: &quot;);
          userInput = Console.ReadLine();
      }   while (string.IsNullOrEmpty(userInput));
  
      Console.WriteLine(&quot;You typed &quot; + userInput);
      Console.ReadLine();
  
      string wantCount;
      do
      {
          Console.WriteLine(&quot;Do you want me to count the characters present? Yes (y) or No (n): &quot;);
          wantCount = Console.ReadLine();
          string wantCountLower = wantCount.ToLower();
      }   while ((wantCountLower != 'y') || (wantCountLower != 'n'));
  }
  </code></pre>
  <p>I'm having trouble from <code>string wantCount;</code> onwards. What I want to do is ask the user if they want to count the characters in their string, and loop that question until either 'y' or 'n' (without quotes) is entered.</p>
  <p>Note that I also want to cater for upper/lower case being entered, so I image I want to convert the wantCount string to lower - I know that how I currently have this will not work as I'm setting <code>string wantCountLower</code> inside the loop, so I cant then reference outside the loop in the <code>while</code>  clause.</p>
  <p>Can you help me understand how I can go about achieving this logic?</p>