Jump to content
Sign in to follow this  

Using a Variable Variable

Recommended Posts


Is it possible to use a string contained within a variable as the variable name itself? For example:

Dim Array1[2]

Dim Array2[2]

Func Velocity($Name)

$Name = "$Array" & $Name

;Return velocity of array




In the function "Velocity" the string contained within $Name varies. Can the contents of $Name be used as the variable name, or perhaps there is another way to do this? This is just an example of what I am trying to do, the real thing is more complicated. Thank you.

Share this post

Link to post
Share on other sites

You can use Assign

Assign ( "varname", "data" [, flag] )

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this