Hello,

This is part of code I posted in another thread. Seems like the process works, I can load my arrays. But when I make a choice from a menu list. it just jumps out of the while loop. It does not enter the switch. I am sure I am making this harder than it is.

Thank you in advance.

while (entry != 'x' && entry != 'X')
           {

               Console.WriteLine("*****************************************");
               Console.WriteLine("enter an a or A to search account numbers");
               Console.WriteLine("enter a b or B to average the accounts");
               Console.WriteLine("enter an x or X to exit program");
               Console.WriteLine("*****************************************");
entry = Convert.ToChar(Console.ReadLine());

               bool is_X = false;

               while (is_X)    //begin while
               {
                   switch (entry)  //set switch
                   {
                       case 'a':
                       case 'A':
                           accounts.searchAccounts();
                           break;
                       case 'b':
                       case 'B':
                           accounts.averageAccounts();
                           break;
                       case 'x':
                       case 'X':
                           (is_X) = true;
                           break;
                       default:
                           break;
                   }
               }  //end inner while
           } //end outer while

Thank you for the response. I have to say this confuses me. I set is_x to false, so this seems backward, but what you suggested worked. Thank you. I think I need a lot more practice with bool values. ;/

look what you wanted? You wanted to execute the while loop until the is_X is false isn't it? and while(!is_X) = is_X is false. So while(is_X==false) = while(!is_X)

This question has already been answered. Start a new discussion instead.