NOT Operator

Used to perform logical negation on an expression.

Syntax

result = Not expression

The Not operator syntax has these parts:

Part Description
result Required; any numeric variable.
expression Required; any expression.

Remarks

The following table illustrates how result is determined:

If expression is

Then result is
True False
False True

In addition, the Not operator inverts the bit values of any variable and sets the corresponding bit in result according to the following table:

If bit in expression is

Then bit in result is

0 1
1 0

Example

Dim A, B, C, D, MyCheck
A = 10: B = 8: C = 6: D = Null ' Initialize variables.
MyCheck = Not(A > B) ' Returns False.
trace MyCheck
MyCheck = Not(B > A) ' Returns True.
trace MyCheck
MyCheck = Not(C > D) ' Returns False.
trace MyCheck
MyCheck = Not A ' Returns -11 (bitwise comparison).
trace MyCheck

 

See Also

Operators