Trying to set up a menu in the start of program
I am trying to make a simple program that shows a menu in the start, and the user can choose one of the choices on the menu.
Here is what I wrote so far,
but it's not working for some reason, and I am getting an error called "unreachable code detected" on Console.Write("press Enter to continue");
Halp~~ QQQQ
static void Main(string[] args)
{
//menu
Console.WriteLine("<<Temperature Conversion>>");
Console.WriteLine("1 - Celsius (C) to Fahrenheit (F)");
Console.WriteLine("2 - Fahrenheit (F) to Celsius (C)");
Console.WriteLine("Q - Quit\n");
Console.Write("Choose (1, 2, or Q):");
//User input
string optionChoice = Console.ReadLine();
optionChoice = Console.ReadLine();
switch (optionChoice)
{
case "1":
Console.WriteLine("Celsius (C) to Fahrenheit (F)");
break;
case "2":
Console.WriteLine("Fahrenheit (F) to Celsius (C)");
break;
case "Q":
case "q":
Console.WriteLine("Bye bye~");
break;
default:
Console.WriteLine("{0} is not valid", optionChoice);
break;
Console.Write("press Enter to continue"); //Where error is
Console.ReadLine();
{
while (optionChoice != "Q" && optionChoice != "q") ;
}
}