Skip to main content

NOT

Syntax

NOT expression

Description

Not, at its most primitive level, is a operation, a logic function that takes one bit and returns a inverted bit. This function returns true if the bit is false, and false if the bit is true. This also holds true for conditional expressions in ARMbasic . When using "Not" encased in an If block, While loop, or Do loop, the output will behave quite literally:

IF NOT condition1 THEN expression1

Is translated as:

IF condition1 is
false THEN perform expression1

When given a expression, number, or variable that return a number that is more than a single bit, Not is performed "bitwise". A bitwise operation performs a logic operation for every bit. The boolean math expression below describes this:

00001111 NOT

-------- equals

11110000

Notice how in the resulting number of the operation, reflects an NOT operation performed on each bit of the expression. The same logic is also used when working with conditions. Not, when used bitwise, is mostly performed with positive integers, such as UInteger, UByte, or ULongInt. It can, however, be used with any numerical type.

Example

' Using the NOT operator on a numeric value

numeric_value = 15 '00001111

'Result = -16 =
111111111111111111111111111110000

PRINT NOT numeric_value

END
' Using the NOT operator on conditional expressions

numeric_value1 = 15

numeric_value2 = 25

IF NOT numeric_value1 = 10 THEN PRINT "Numeric_Value1 is not equal to 10"

IF NOT numeric_value2 = 25 THEN PRINT "Numeric_Value2 is not equal to 25"

END

' This will output "Numeric_Value1 is not equal to 10" because

' the first IF statement is false.

' It will not output the result of the second IF statement because the

' condition is true.

Differences from other BASICs

  • None

See also