Post Reply 
{ Vars List} how to store a value in one var of the list ?
02-05-2014, 12:42 PM (This post was last modified: 02-05-2014 12:52 PM by Snorre.)
Post: #2
RE: { Vars List} how to store a value in one var of the list ?
Hello Joseph,

You could try an EXPR("A1:="+value); or in your case EXPR(L1(k)+":="+value);
But I think this won't work in your program since all program variables have to be previously defined, even if used in such a "dynamic" context.
If you want your values to be accessible in CAS you may do a CAS(L1(k)+":="+value) as the CAS can create variables on demand.

Why is it so important to store your values in distinct variables?
You could also store them in a second list (global within your program but invisible to the outside world) and use your L1 just as an index map, e.g.

--------8<---------
storage:=MAKELIST(0,I,1,n); // n actual values (preserved between program calls)

MyProg()
BEGIN
L1:={index1,index2,...}; // indirection table
// ... do something ...
storage(L1(k)):=value; // store value at the L1(k)'th register
END;
-------->8---------
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: { Vars List} how to store a value in one var of the list ? - Snorre - 02-05-2014 12:42 PM



User(s) browsing this thread: 1 Guest(s)