not
Syntax
not(X)
or !(X)
Arguments
X is a scalar/pair/vector/matrix.
Details
Return NOT of each element of X. Returned values are 0, 1, or NULL. NOT of 0 is 1; NOT of NULL is still NULL; NOT of all other values is 0.
Though not
and the !
operator often serve analogous
purposes, precedence behavior differs:
-
The
not
function, when parenthesized carries the highest priority. Without parentheses,not
has lower precedence than the following expression, e.g.,not false and false
is equivalent tonot(false and false)
, which returns true. -
The
!
operator always follows the precedence rule. For example:!false and false
is equivalent to(!false) and false
, which returns false.