Hi Ed,
if I use int instead of float I will get the expected results.
I am not sure if short circuit logic with floats will work in Oxygenbasic. I used two temporary vars y1 and y2 for (a <> 0) and (b <> 0) and as there is x = (a and b) I used this statement: if x then j = -1 else j = 0.
With these changes I would get the expected results too.
Roland
int a, b, x, y, j, k
a = 0
b = -1
x = (a <> 0) ' (1) expect 0 got 0
y = (b <> 0) ' (2) expect -1 got -1
j = (x and y) ' (3) expect 0 got 0
k = (a and b) ' (4) expect 0 got 0
print "x: " x " y: " y " j: " j " k: " k
a = 0
b = -1
x = (a and b) ' (5) expect 0 got: 0
y = (a <> 0) and (b <> 0) ' (6) expect 0 got: 0
if (a and b) then j = -1 else j = 0 ' (7) expect 0 got: 0
if (a <> 0) and (b <> 0) then k = -1 else k = 0 ' (8) expect 0 got: 0
print "x: " x " y: " y " j: " j " k: " k
'------------------------------------------
float a, b, x, y, j, k, y1, y2
a = 0
b = -1
x = (a <> 0) ' (1) expect 0 got 0
y = (b <> 0) ' (2) expect -1 got -1
j = (x and y) ' (3) expect 0 got 0
k = (a and b) ' (4) expect 0 got 0
print "x: " x " y: " y " j: " j " k: " k
a = 0
b = -1
x = (a and b) ' (5) expect 0 got: 0
y1 = (a <> 0) : y2 = (b <> 0)
y = (y1 and y2) ' (6) expect 0 got: 0
if x then j = -1 else j = 0 ' (7) expect 0 got: 0
if (a <> 0) and (b <> 0) then k = -1 else k = 0 ' (8) expect 0 got: 0
print "x: " x " y: " y " j: " j " k: " k