I am currently doing an assignment for my programming subject and we're currently focusing on input validation. My current issue is when checking to see if the user has inputted their gender correctly, (M, m, F or f)
I am using:
Console.Write("Please enter your gender (m) or (f) : ");
response = Console.ReadLine();
string gender = response;
if (gender != "m" || gender != "M" || gender != "f" || gender != "F")
{
Console.WriteLine("Error : Gender must be either : M / m (For Male) or F / f (For Female) ");
Console.ReadLine();
Environment.Exit(0);
}
The console is outputting "Mistake" for absolutely anything that I enter, however, when I remove the last three parts of the condition and leave it as (gender != "M") it seems to work fine.