string confirm = "";
while (confirm != "y" || confirm != "n")
{
Console.Write("Remove {0}' account? (Y/N): ", Accounts[accountNumber].Name);
confirm = Console.ReadLine();
confirm = confirm.ToLower();
}
For some unknown reason my loop fails on the check. Even if confirm IS either “n” or “y” it will still loop round again. I have even checked it is definitely matched to either “n” or “y” by using a break-point. So why is this failing the check each time?
Because your string cant be both
yandn. Replace the||with&&: