Not Operator

For a Boolean expression, returns the opposite value. For an integer expression, does a bitwise NOT operation.

Syntax

Not expression

Parts

expression
A Boolean or integer expression.

Instructions

For Boolean expressions, the table that follows shows how to calculate the result.

Truth table for Not expression
If expression is Then the result is
TrueFalse
FalseTrue

For numeric expressions, the result of the operator NOT is the opposite value of each bit. See the table that follows.

Bitwise operation for NOT expression
If the bit in expression is Then the bit in the result is
10
01

Note: The logical and bitwise operators have lower precedence than the arithmetic and relational operators. Thus, we recommend that you put parentheses around bitwise operations to make sure they give correct results.

Examples

Var pattern As UInt8 = %B11110000
Var inverse = Not pattern
After run
VariableValue
pattern 240 (11110000)
inverse  15 (00001111)

See also