C#: WHILE loop continues, seemingly ignoring the condition
Solution 1:
Your while loop is, logically, while (true)
.
q1 != "A"
That’s false if q1 is A, otherwise it’s true
q1 != "B"
That’s false if q1 is B, otherwise it’s true
Since A is not B, there’s no way both of those statements can be false at the same time, so you have
- A) false || true
- B) true || false
- other) true || true
Since true-or-anything is true, your condition is just true
.