testing for equlaity

BlitzMax Forums/BlitzMax Beginners Area/testing for equlaity

Defoc8(Posted 2008) [#1]
havent used bmax in a while - was wondering how to make this statement valid..

if(not this = that)
...
...
...
endif

assuming "this" and "that" are the same type. i expected the statement to
work correctly - instead, an error is reported - "cannot convert to int!".. im guessing the object refs are not considered integers for
safety reasons..

do i have to cast the this and that vars to pointers? so that an
integer compare can be done?

cheers!
matt/defoc8


tonyg(Posted 2008) [#2]
Use <>
Local A:String="HELLO"
Local B:String="HELLO"
Local c:String="WORLD"

If A<>B Print "A not the same as B"
If A<>C Print "A not the same as C"

If I have misunderstood the question please post some example code.


Defoc8(Posted 2008) [#3]
..yup - thanks... heh, dont know why i didnt try that first.. oh well.


Floyd(Posted 2008) [#4]
I think the original problem is that Not has higher precedence than the = equality operator. Thus the condition became

(Not this) = that

It was the (Not this) part that produced the error message.

So the condition should have been Not (this = that), or the equivalent (this <> that).