assignment

Archives Forums/Blitz3D Bug Reports/assignment

mindstorms(Posted 2006) [#1]
I had this mistype in my program, and was wondering why the blitz debugger never picks it up (debugging on and off).

res=a=hi()     ;the problem part
Function hi()
	Return 1
End Function
print res
print a
waitkey()
end


in fact, it won't even catch it if the line is simply res=a=5 or any other constant. Is this supposed to happen? If it is, shouldn't res also be assigned to the value?


Floyd(Posted 2006) [#2]
(a=b) is a logical expression, like (a>b). It evaluates to True or False.

So res=a=hi(i), which is the same as res = (a=hi()), assigns either True or False to res.
It doesn't assign anything to a, it just makes a comparison.

Note that True is the constant value 1, and False is 0.


mindstorms(Posted 2006) [#3]
That's annoying....I guess I am used to python-it assigns to both. Sorry about the false bug.