string confirm = "";
while (confirm != "y" || confirm != "n")
{
Console.Write("Remove {0}' account? (Y/N): ", Accounts[accountNumber].Name);
confirm = Console.ReadLine();
confirm = confirm.ToLower();
}
由于某些未知原因,我的循环在检查中失败。即使确认是“n”或“y”,它仍然会再次循环。我什至通过使用断点检查了它是否绝对匹配“n”或“y”。那么为什么每次都没有通过检查呢?