Report Bugs Here

Moderator: Mmiscool

User avatar
By PhilTilson
#53403 Previous posts have noted that ALL variables appear to be assigned string status initially - but it's a bit more complicated than that!
Code: Select allx=27
y=27
if x=y then print "The same!" else print "Different!"
end

results in: "Comparaison between string and number!" on lines 2 and 3.

Code: Select allx=0
y=0
x=27
y=27
if x=y then print "The same!" else print "Different!"
end

gives the same error on lines 2, 4 and 5. However...

Code: Select allx = 27
y = 27
if x=y then print "The same!" else print "Different!"
end

results in "The same!" (ie the correct result)

According to the latest documentation,
Spaces are don’t care :

A = 5 + 3 is the same as a=5+3

Clearly this is not the case!

Phil
User avatar
By Mmiscool
#53443 Can you point out in the docs where it says the spaces don't matter?

For assignment of a value to variable you must have spaces around the = sign.

x = 0

x = 27
User avatar
By PhilTilson
#53923 I have now tested this point more carefully.

The only space that seems to matter is the one between the variable getting the value and the '=' sign. So:

Code: Select alla=1+2          will NOT work
a = 1 + 2      does work.  But...
a =1+2         also works!
print a&b&c    Also works fine

So it seems that the initial space is the only one that is essential, though including others may make for better layout and readability.

Phil