How do I create a terminable while loop in console application? code example

Example: How do I create a terminable while loop in console application?

bool right_choice = false;
int P1Choice = int.Parse(Console.ReadLine());
while(!right_choice) {
    switch(P1Choice) {
        case 1: 
             right_choice = true;
             {case 1 code};
             break;
        case 2:
             right_choice = true;
             {case 2 code};
             break;
        case 3:
             right_choice = true;
             {case 3 code};
             break;
        case 4:
             right_choice = true;
             {case 4 code};
             break;
         default:
             break;
    }
    if (!right_choice) {
        Console.WriteLine("");
        CenterWrite("Input Invalid, Please press the number from the corresponding choices to try again");
        Console.ReadKey();
        P1Choice = int.Parse(Console.ReadLine());
    }    
  }    
}

Tags:

Misc Example