|
Post by Roger Cabo on Apr 7, 2024 19:17:17 GMT 1
I'm surprised after 30 years!
Dim a%%%%%%%%%%% = 1 Dim a%= 2
Msgbox a%%%%%%%%%%% & " " & a%
|
|
webu
Full Member
Posts: 149
|
Post by webu on Apr 7, 2024 19:31:51 GMT 1
Try this:
Dim a% = 1 Dim a%% = 2 Dim a%%% = 3 Dim a%%%% = 4
Print a%; a%%; a%%%; a%%%% // -> 1 2 3 4
|
|
|
Post by Roger Cabo on Apr 7, 2024 23:30:09 GMT 1
does this have any reason, or is there anything special to this, I don't know?
|
|
webu
Full Member
Posts: 149
|
Post by webu on Apr 7, 2024 23:44:48 GMT 1
I didn't know that either and was also surprised.
Deutsch: Ich wusste das auch nicht und war auch überrascht.
|
|
|
Post by dragonjim on Apr 8, 2024 0:41:01 GMT 1
This is interesting as well:
Dim a%$ = 1 Print VarType(a%$) // 255 Print TypeName(a%$) // String Dim a$% = 1 Print VarType(a$%) // 3 Print TypeName(a$%) // Integer Dim a$a = 1 Print VarType(a$a) // 3 Print TypeName(a$a) // Integer (in a Variant)
It seems that GFABASIC only takes note of the last character of a variable name to see if it is a postfix; the rest it assumes is part of the variable name.
Very interesting.
|
|
|
Post by Roger Cabo on Apr 8, 2024 8:34:03 GMT 1
Yes.. interesting and I never know before. This behavior seems to be much faster to recognize variables in terms of compiling code through the interpreter logic.
But anyway I have no problem with this.. and it works pretty well like all the other stuff in gb32. 👍☺️
|
|
|
Post by (X) on Apr 12, 2024 14:14:12 GMT 1
From the Help Doc... An interesting table of Data Type information in the Help Doc under Data Types...
|
|
|
Post by larrybtoys on Apr 13, 2024 1:25:24 GMT 1
Frankly it seems a bit weird that it does this. I would think that using a variable TEST% several times throughout the program and then mistakenly typing TEST%% would be a tough bug to find. I suppose that I find it more of a problem because I like to use the AUTO command at the beginning of my code rather than declare all my variables. I am old school. I do at least remove the AUTO command and declare them all after I have complete the program.
|
|