Relational expressions

Started by Zlatko Vid, February 26, 2024, 10:00:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zlatko Vid

Hi Charles

did i test this code properly
looks that AND and OR expressions not work
work with NUMBERS but with variables not

'test relation operators in o2
float a,b
int i

a= 10 : b =15
i = a > b
print i      ' result 0 ..ok!
i = a < b
print i      'result -1...ok!
i = a != b
print i      'result -1 ..ok

'i = a | b    'assembler error
'i = b & a     'assembler error

Charles Pegge

Hi Aurel,

You cannot do bitwise/logical operations with floats directly, but you can do this:

i = (a<>0) | (b<>0)

o2 also supports boolean conditionals for both floats and strings as well as integers.

if a then print "ok"