Interactive PowerBasic Forum

IT-Consultant: Charles Pegge => OxygenBasic Examples => Topic started by: Zlatko Vid on February 26, 2024, 10:00:28 PM

Title: Relational expressions
Post by: Zlatko Vid on February 26, 2024, 10:00:28 PM
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
Title: Re: Relational expressions
Post by: Charles Pegge on February 27, 2024, 12:51:56 AM
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"