NOT

Result = NOT Expression

Computes the logical not of an expression.

The logical NOT operator takes one boolean expression and returns its contrary. The result returned by this operation is shown in the following table:

A NOT A
FALSE TRUE
TRUE FALSE

The numerical NOT operator takes one integer value and returns an integer value. The operator actually inverts each bit of the expression, as shown in the following table:

A NOT A
0 1
1 0

If Expression is a string or an object, it returns TRUE if Expression is null, and FALSE if it is not null.

Examples

PRINT NOT TRUE
False

PRINT NOT FALSE
True

PRINT 11, Bin(11, 16)
PRINT NOT 11, Bin(NOT 11, 16)
11      0000000000001011
-12     1111111111110100

PRINT 11, Bin(11, 16)
PRINT NOT 11, Bin(NOT 11, 16)
PRINT CByte(11), Bin(CByte(11), 8)
PRINT CByte(NOT 11), Bin(CByte(NOT 11), 8)
11      0000000000001011
-12     1111111111110100
11      00001011
244     11110100

PRINT NOT "Gambas"
False

PRINT NOT ""
True

See also