Examples using logical operators
The logical operators (!, &, and |) combine logical values. The following operations all result in a value of True. The operations are shown twice, with and without parentheses. The parentheses clarify the order of evaluation but are unnecessary because the logical operations are less in precedence than the surrounding comparison operations.
4 = 2 + 2 & 5 = 3 + 2
(4 = 2 + 2) & (5 = 3 + 2)
4 = 2 + 2 | 5 = 2 + 2
(4 = 2 + 2) | (5 = 2 + 2)
! 5 = 2 + 2
! (5 = 2 + 2)