February 2014
Beginner
1248 pages
62h 25m
English
The boolean logical AND (&) and boolean logical inclusive OR (|) operators are identical to the && and || operators, except that the & and | operators always evaluate both of their operands (i.e., they do not perform short-circuit evaluation). So, the expression
(gender == 1) & (age >= 65)
evaluates age >= 65 regardless of whether gender is equal to 1. This is useful if the right operand has a required side effect—a modification of a variable’s value. For example, the expression
(birthday == true) | (++age >= 65)
guarantees that the condition ++age >= 65 will be evaluated. Thus, the variable age is incremented, ...
Read now
Unlock full access