Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Variable Names - A noobish question
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TheZsterBunny




PostPosted: 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
Sponsor
sponsor
Delos




PostPosted: 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




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: