Asked by: Brian Johnson219 viewsITOctober 27, 2018
Thank you for detailed steps and results!
2 Answers
+4Votes
Hello, there is no step at all. It’s very simple. The test site is the combination of operators. The important point of this question is: short-circuit rule of ||
A||B is true or true means that AB has a true result and is true. If A is 1, it will not calculate B. This is called the short-circuit rule.
X++; This is the first to use X then X+1
The other point is Zero is true.
So only j++ is evaluated, so the output is j=1+1, the others are unchanged.
Answer: The picture shows the result.
Question: || and && Which priority is higher? Which one counts first.
+4Votes
Hello, there is no step at all. It’s very simple. The test site is the combination of operators. The important point of this question is: short-circuit rule of ||
A||B is true or true means that AB has a true result and is true. If A is 1, it will not calculate B. This is called the short-circuit rule.
X++; This is the first to use X then X+1
The other point is Zero is true.
So only j++ is evaluated, so the output is j=1+1, the others are unchanged.
+3Votes
Like the big brothers upstairs