Reputation: 23
When I ask from user and input, it always falls in the loop even if it is the right input or not:
Console.WriteLine("Μήπως σκέφτηκες το " + n);
answr = Console.ReadLine();
while (answr != "N" || answr != "Y")
{
Console.WriteLine("Δεν μπορώ να καταλάβω την απάτηση σου. Ξαναπροσπάθησε: ");
answr = Console.ReadLine();
}
Upvotes: 0
Views: 59
Reputation: 3028
This is wrong (answr != "N" || answr != "Y")
It should be (answr != "N" && answr != "Y")
If answr == "N"
then it won't equal "Y", returning true.
If answr == "Y"
then it won't equal "N", also returning true.
Upvotes: 2