Boolean operators

All Boolean operators return 1 (‘nonzero’) if the condition is met and 0 if it is not. The operator ‘not’ can be used to negate an expression, but remember to use parenthesis, as ‘not’ is stronger than all other operators: ‘not 1 > -1’ is nonzero, while ‘not (1 > -1)’ is zero. The other Boolean operators are all weaker than the arithmetic operators.

Operator

Description

Not

Nonzero if the expression after ‘not’ is zero, otherwise zero.

<, <=, >, >=, =, <>

Value comparison operators.

And

Nonzero if the expressions on either side of ‘and’ are both nonzero.

Or

Nonzero if one or both of the expressions on either side of ‘or’ is nonzero.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.