title: Only allowing yes or no as an answer
body: <p>I am a complete newbie and i am stuck on a small problem</p>
  
  <p>I want the user to only be able to have <strong>yes</strong> or <strong>no</strong> as an answer.</p>
  
  <p>This is what I came up with</p>
  
  <pre><code>static public bool askBool(string question)
  {
      try
      {
          Console.Write(question);
          return Console.ReadLine() == "y";
      }
      catch (Exception)
      {
          throw new FormatException("Only y or n Allowed");
      }
  }
  </code></pre>
  
  <p>The problem is entering any other letter then <code>'y'</code> will result in false, how can I best solve this ?</p>
  
  <p>Thank you in advance. </p>
  
  <p>EDIT (from comment question) </p>
  
  <pre><code>try
  {
      Console.Write(question);
      return int.Parse(Console.ReadLine());
  }
  catch (Exception)
  {
      throw new FormatException("Please Enter a Number");
  }
  </code></pre>