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
condition1 THEN expression1
IF condition1 = 0 THEN perform
When given a expression, number, or variable that
return a number that is more than a single bit, Not is performed bit-wise. A
bit-wise operation performs a logic operation for every bit.
The Boolean math
expression below describes this:
Notice how in the resulting number of the operation, reflects an NOT
operation performed on each bit of the expression.
When used with conditions NOT becomes a logical operation.
if NOT x>5
then print "x is less than or equal to
'-------- equivalent to
if x <= 5 then
print "x is less than or equal to 5"
In the above example if x is 7 and you PRINT NOT x>5 would print 0, and
print 1 if x is 3.
' Using the NOT operator on a numeric
numeric_value = 15 '00001111
'Result = -16 =
' Using the NOT operator on conditional
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"
' This will output "Numeric_Value1
is not equal to 10" because
' the first IF statement
' It will not output the result of the
second IF statement because the
' condition is true.
Differences from other BASICs