Re: Changing the name of a variable using code

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I don't think you can make X = 23 but you could create a function to which
you would pass your variable name & get the variable value back so that:
GetFromArray(X) = 23.
(The function would have to loop through the entire array looking for X, get
the corresponding value & exiting the loop once found)

This would allow you to access the array elements much like the elements of
a collection, which raises the question (in my mind at least) if you
wouldn't be better off simply putting your variables into a collection in
the first place. It may be a coin toss depending on what you are doing.

HTH


<pltaylor3@xxxxxxxxx> wrote in message
news:1168437599.875075.21790@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have an array that is two wide and an undefined length. The first
column is a name of a variable and the second column is the value of
that variable. How can i define all the items as there name = value?
i.e array(1,0) = X array(1,1) = 23 make it so that X = 23. This is
probably really simple and i would appreciate any help.
thanks
Perry



.



Relevant Pages

  • Re: Changing the name of a variable using code
    ... (The function would have to loop through the entire array looking for X, ... This would allow you to access the array elements much like the elements of ... column is a name of a variable and the second column is the value of ...
    (microsoft.public.excel.programming)
  • Re: New style DO syntax?
    ... Joe Krahn wrote: ... I think that the DO-loop is the only "block construct" that does not contain the 'expression/attribute' part in parenthesis. ... Using parenthesis for delimiters should also allow for using array elements as do iterators. ... Capture the value of I at loop start and use that for ...
    (comp.lang.fortran)
  • Re: Word counting
    ... length so increment our word length to search for by 1. ... Loop through our array elements and hopefully we'll have the words ... This is an example input file ...
    (comp.lang.ada)
  • Re: array help needed
    ... You show 'add.item loop' in your latest post... ... exactly what are you planning to add your array elements to? ... my cell values store spreadsheet names and i wish to store them all in the ... "shg" wrote: ...
    (microsoft.public.excel.programming)
  • Re: converting .dat file to array
    ... array elements corresponding to indices greater than the number of data ... According to the standard, ... The actual behavior is compiler dependent. ... You need to so something with a loop, ...
    (comp.lang.fortran)