lang • not

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