Str(A_String$+An_Int%)

Archives Forums/BlitzPlus Bug Reports/Str(A_String$+An_Int%)

_PJ_(Posted 2016) [#1]
Not so much a real bug, but somewhat curious unexpecetd behaviour all the same.

Of course,one shoudln't be using the Str() function with a string in the first place, but I think it interesting how the arguments are considered according to which appears first:

z$=Str("a"+x+y)
Print z
z$=Str(x+"a"+y)
Print z
z$=Str(x+y+"a")
Print z


Note: Didn't try anything with Floats.


Floyd(Posted 2016) [#2]
BlitzPlus for some reason does not have a Language Reference. Blitz3D does and you can find an explanation of this in the Expressions section.

Those + expressions are evaluated left to right and integers are being converted to strings. x and y are both zero.

"a"+x+y is ("a"+x)+y = ("a"+"0")+0 = "a0"+"0" = "a00"

(x+y+"a") is (x+y)+"a" = 0+"a" = "0"+"a" = "0a"