05-04-2024, 11:39 PM
Here's a question: What happens when you do the following?
X = 1
X = 2
X = 3
?
Is X now 1, 2, 3?
Of course not!! One variable can NOT contain three different values in it. Things just don't work like that. One value overwrites another, and the variable is only the last value.
Now, what happens when you try the following?
DIM X AS LONG
DIM X AS SINGLE
DIM X AS STRING
Is X now a LONG, SINGLE, STRING?
Of course not!! One variable can only be one type at a time. If it wasn't, how the hell would you ever work with it??
x = "a"
x = "a" + 1
Now, what the heck is x?? Is it "a1"? Is it "a" + chr$(1)? If it "b"?
Who knows!! It might be milk and cookies and snuggles and rainbows, in some insane guy's philosophy. I can tell you what it is in BASIC however -- and we're talking any basic here: IT'S AN ERROR!!
Variable types don't work that way. Never have. Never will.
IF you like suffixes, then use suffixes. There is absolutely NOTHING stopping you from going apeshit crazy and using the same variable name for everything in your code -- including labels and such as well, if you're insane enough to do so.
There's just certain rules of syntax that are non-negotiable.
You can't redefine CONSTS.
CONST a = 3
CONST a = 5 'ERROR!! ERROR!!
You can't assign a variable to be more than a single type.
DIM a AS LONG
DIM a AS SINGLE 'ERROR!! ERROR!!!
It just doesn't work. Never has. Never will.
If that's not acceptable, then you'll probably want to find some other programming language to work in that's more user-friendly for you. Maybe try Java.
X = 1
X = 2
X = 3
?
Is X now 1, 2, 3?
Of course not!! One variable can NOT contain three different values in it. Things just don't work like that. One value overwrites another, and the variable is only the last value.
Now, what happens when you try the following?
DIM X AS LONG
DIM X AS SINGLE
DIM X AS STRING
Is X now a LONG, SINGLE, STRING?
Of course not!! One variable can only be one type at a time. If it wasn't, how the hell would you ever work with it??
x = "a"
x = "a" + 1
Now, what the heck is x?? Is it "a1"? Is it "a" + chr$(1)? If it "b"?
Who knows!! It might be milk and cookies and snuggles and rainbows, in some insane guy's philosophy. I can tell you what it is in BASIC however -- and we're talking any basic here: IT'S AN ERROR!!
Variable types don't work that way. Never have. Never will.
IF you like suffixes, then use suffixes. There is absolutely NOTHING stopping you from going apeshit crazy and using the same variable name for everything in your code -- including labels and such as well, if you're insane enough to do so.
Code: (Select All)
Dim a%, a$, a!, a%%, a$1
a% = 1
a$ = "two"
a! = 3.4
a%% = 4
a$1 = "5"
GoSub a
End
a:
Print a%, a$, a!, a%%, a$1
Return
There's just certain rules of syntax that are non-negotiable.
You can't redefine CONSTS.
CONST a = 3
CONST a = 5 'ERROR!! ERROR!!
You can't assign a variable to be more than a single type.
DIM a AS LONG
DIM a AS SINGLE 'ERROR!! ERROR!!!
It just doesn't work. Never has. Never will.
If that's not acceptable, then you'll probably want to find some other programming language to work in that's more user-friendly for you. Maybe try Java.