Choose Language Hide Translation Bar
Community Trekker

multiple assignments to list elements

Here is a short example script, which should do multiple assignments to list elements.
It works when both sides of the assignment are direct lists :


We would like to generalize this so that both sides of the assigment can be variables.

X = .;
Y = .;
D = {X, Y};
B = {4, 55};
C = {{}, {}};

C[1] = D;
C[2] = B;

{X, Y} = C[2]; //works as multiple assignments
Print( X, Y );

// How can the left hand side also use a variable??
//e.g. C[1]=C[2] similar to the following
The idea is to use this technique to return many object references from a function which changes the status of a window. Thus we want to return a list of object names and object references from the function and assign those in the caller function. The main though is not to use any hardcoded names.

0 Kudos
Super User

Re: multiple assignments to list elements



Your question is not clear.  Please provide a more details. There are many examples of one function taking arguments creating a window and returning results for other functions to use.  More details will improve your chances of getting an answer to meet your needs. 



0 Kudos