Variable Names - A noobish question
Author |
Message |
TheZsterBunny
|
Posted: Mon Jul 12, 2004 8:01 pm Post subject: Variable Names - A noobish question |
|
|
is it possible to dynamically create variables in turing?
i.e. get a string and create a variable called 'the value of that string'?
if so, this may be useful.
-Z |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Delos
|
Posted: Mon Jul 12, 2004 8:41 pm Post subject: (No subject) |
|
|
No...
Variables are spaces in memory set aside at the outset of a programme (and often times within), but are predetermined names.
You will have to suffice with flexible arrays.
Unless...you made some sort of self-destructive if structure...
I've thought of this quite a bit myself...and I'm not sure if I still understand what I found so allurering about it. Flexible arrays can do the job...you'd just be dealing with indicies instead of flatout names... |
|
|
|
|
|
Tony
|
Posted: Mon Jul 12, 2004 9:52 pm Post subject: (No subject) |
|
|
if you want to let user specify which variable to access at one point or another, it can be achieved by having 2 arrays (flexable arrays if you want to dynamically create new "variables")
one array to hold the actually value, and another one is used to assosiate a string with index position for the value in the first array. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|