Page 1 of 1

Posted: Sat Mar 29, 2003 10:21 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.

I was just trying something out, trying to get the results of comparison operators (it could be useful in some situations :). However, it seems that PureBasic does not provide any reliable result.

Try the following code. It gives a value of 4 when the numbers are different and a value of 3 when they are the same (yes, I am aware that it seems to track the value of the b variable :).

Code: Select all

a.l = 3
b.l = 4
;b.l = 3 ; Also try it with this, it still evaluates to true
c.l = (a  b)
Debug Str(c)
End
I would prefer that this is a valid set of instructions and that it returns an appropriate (i.e. correct) result. The other option would be to make this code invalid, preventing any misuse.

What do you all think?

--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.62, external editor)

Posted: Sat Mar 29, 2003 10:37 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.

you can use a little trick to get the correct result of a logical expression:

Code: Select all

a.l = 3
b.l = 4
;b.l = 3
c.l = 0 Or (a  b)
Debug Str(c)
End

Posted: Sat Mar 29, 2003 11:27 pm
by BackupUser
Restored from previous forum. Originally posted by tinman.
Originally posted by Pupil

you can use a little trick to get the correct result of a logical expression:
Yes, I have done such things with And before but wouldn't it be so much nicer to not have to? :)

--
I used to be a nihilist but I don't believe in that any more.
(Win98first ed. + all updates, PB3.62, external editor)

Posted: Sat Mar 29, 2003 11:39 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.

> Yes, I have done such things with And before but wouldn't it be so much nicer to not have to? :)

Indeed it would :)