title: Do while loop not looping when condition is true
body: <p>What is wrong with my do while loop logic? </p>
  
  <p>I want to prevent users from proceeding further into the application unless they provide the correct input.</p>
  
  <p>Currently, it will only accept one wrong input before it crashes and produces this exception:</p>
  
  <blockquote>
    <p>System.Exception: 
        at disabler.Program.readInput(String Input) 
        at disabler.Program.detectInput(String Input) 
        at disabler.Program.Main(String[] args) </p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>   private static string detectInput(string Input )
      {
          string result= Input;
          do
          {
              //pass input to readInput method
              if ((result == "exit") || (result == "query") || (result == "disable"))
              {
                  readInput(result);
              }
              else 
              {
                  Console.WriteLine("invalid input detected. Please try again.");
                  result= Console.ReadLine();
                  readInput(result);
              }
          }
          while (!((result == "exit") || (result == "query") || (result == "disable")));
          return result;
      }
  </code></pre>
  
  <p>Here is the code for readInput method:</p>
  
  <pre><code>//Read user input
      private static string readInput(string Input)
      {
          int successfullyDisabled = 0;
          string input = string.Empty;
          switch (Input)
          {
              case "disable":
                              int disableCounter = 0;
                  invalidAccount.ForEach(delegate(String samAccountName)
                  {
                      disableCounter++;
                      Console.Write(disableCounter);
                      //disable inactive accounts
                      if (DisableADUser(samAccountName))
                      {
                          successfullyDisabled++;
                      }
                  });
  
                  invalidAccount.Clear();                    
                  validAccount.Clear();
                  Console.WriteLine("Press [ENTER] to continue or [ESC] to exit.\n");
                  break;
              case "query":                   
                              Console.WriteLine("No.\t  | Dep | User Account\t       | Status");                               
                              int countRow = 0;
                  validAccount.ForEach(delegate(String samAccountName)
                  {
                      countRow++;
                      Console.Write(countRow);
                      //find status of active accounts
                      findUserStatus(samAccountName);
                  });
                  validAccount.Clear();
                  invalidAccount.Clear();
                  Console.WriteLine("Press [ENTER] to continue or [ESC] to exit.\n");
                  break;
              case "exit":
                  //leave console
                  Environment.Exit(2);
                  invalidAccount.Clear();
                  validAccount.Clear();
                  break;
              default:
                  throw new Exception("Invalid command entered. Please enter command again.");
          }
          return input;
      }//end of ReadInput
  </code></pre>