AND/OR (&&/||) logic for multiple condition statements

Viewed 44004

If you have an if-statement in C# that checks multiple conditions:

if (a == 5 && b == 9) { ... }

Does b == 9 still get checked if a == 5 condition is false, or does it automatically exit since there's no way this could pass anymore?

Similarly, for an OR if-statement:

if (a == 5 || b == 9) { ... }

Will b == 9 still get checked if a == 5 is true?

6 Answers
Related