posted 23 years ago
The expression (flag=true) has two effects:
FIRST, since this is an assignment expression, the value on the right-hand side (true) is copied into the variable on the left-hand side (flag)
SECOND, the value of the expression is evaluated. The value of this expression is simply the value of the flag variable, ie, true, since it was just assigned this value.
Now when the if() statement checks the value, it will be true, since flag is true.