Page 1 of 1

numeric string constants change type

Posted: Wed Aug 13, 2025 10:06 am
by HeX0R
Probably not an IDE problem but a compiler problem?
I had to add a constant into compiler options -> constants, which was:
#TEST = "123"
But this seems to be swapped into #TEST = 123, because this here ends-up with a "Bad parameter type, string expected" error:

Code: Select all

Debug Len(#TEST)

Re: numeric string constants change type

Posted: Wed Aug 13, 2025 10:27 am
by STARGĂ…TE
Confirmed. All numeric like strings are converted to integer or float.

Re: numeric string constants change type

Posted: Wed Aug 13, 2025 12:20 pm
by blueb
Hmm... that's odd? My debug returns 3
My system is very close to Stargate's.

Re: numeric string constants change type

Posted: Wed Aug 13, 2025 12:34 pm
by HeX0R
did you really follow the description?
add a constant into compiler options -> constants

Re: numeric string constants change type

Posted: Wed Aug 13, 2025 12:40 pm
by NicTheQuick
Confirmed on Ubuntu Linux.

Re: numeric string constants change type

Posted: Wed Aug 13, 2025 12:46 pm
by Kiffi
Confirmed. Mac Mini M4 (Sequoia)

Re: numeric string constants change type

Posted: Wed Aug 13, 2025 1:28 pm
by blueb
HeX0R wrote: Wed Aug 13, 2025 12:34 pm did you really follow the description?
add a constant into compiler options -> constants
Sorry... I missed that 'complier options' part. (even though you made it obvious) :(

Yes, I get the same results as you.

Re: numeric string constants change type

Posted: Wed Aug 13, 2025 1:45 pm
by mk-soft
If you use a letter or special character, it works.
#Test=#123

Re: numeric string constants change type

Posted: Thu Aug 14, 2025 7:47 am
by Piero

Code: Select all

; #TEST = ~"123"
Debug #TEST ; Result: ~"123
:shock: