Reputation: 1
This is a short function to check and make user write uppercase Y or N .I dont know why but even if the user enter upper case Y or N , still then the loop does not exit. Any help please?
static char GetUpperCaseYN()
{
char choice='y';
Console.WriteLine("Calculate Another? Y/N ");
choice = char.Parse(Console.ReadLine());
while (choice != 'Y' || choice != 'N')
{
Console.WriteLine("Invalid Response.Please enter Y or N");
choice = char.Parse(Console.ReadLine());
}
return choice;
}
Upvotes: 0
Views: 62