So I had this question in a Comp Sci midterm last year and I still can't figure out why a&&b and b&&a would not evaluate to the same result
The way I see it, there are 4 possible cases :
- A is TRUE and B is TRUE :
- True && True is True
- A is TRUE and B is FALSE :
- True && False is False and False && True is also False
- A is FALSE and B is TRUE :
- False && True is False and True && False is False
- A is FALSE and B is FALSE :
- False && False is False
Yet, the correction of the midterm and the prof say that a&&b and b&&a don't always evaluate to the same result.
EDIT: I don't see how this is a duplicate of "operator short-circuiting" ... in no way am I asking a question about the first part of the AND operation ... I am asking about both parts and the "original" question to which this is a duplicate does not answer my question.