Given this code fragment:
What is the outcome?
The prefix increment in y = ++x makes both x and y equal to 11. Boolean | does not short-circuit, so the right operand evaluates ++x, increasing x to 12. The condition is true and z receives x, so the printed value is 12.
y = ++x
x
y
|
++x
z
Community Discussion