number OR number

In BASIC all logic operators are context sensitive.  The default is to perform a bitwise operation on 32 bit numbers.  So that

number1 = &H55555555
number2 = &H33333333
print HEX(number1 OR number2)

Result is 77777777.  The function HEX (param) returns a string representing the hex value param.

But is the context includes a comparison then the AND operation becomes a logical operation

IFnumber1 > 5 OR number2 > 5 THEN statement1

So if either of the 2 conditions are TRUE then statement1 is executed.

If you are going to mix logical and bitwise operators then use () in the expression to evaluate the bitwise operations first, see the example below.


if (x or y)=&H77 or x<y then print "OK" 

' This will print OK as X OR Y is &H77

Differences from PBASIC

See also