Subscribe Bookmark RSS Feed

List of variables not reporting the way I want

I'm trying to create a return statement for a function that contains multiple local variables.
Basically:

a= 1;
b = {1,2,3};
c= {"a","b","c"};
return = {a,b,c};

I want to have return == {1,{1,2,3},{"a","b","c"}}
but instead i get return == {a,b,c};

since a,b,c are local variables in a funtion return has no meaning when its sent out of the function.

Any Ideas?
2 REPLIES
Nevermind. Found the answer myself about 5 min later.

For anyone who is having the same problem
eval list(return) works.
mpb

Super User

Joined:

Jun 23, 2011

This example seems to work as you want:

myListFunc = Function( {x1, x2, x3}, Eval List( {x1, x2, x3} ) );
myListVal = myListFunc( 1, {1, 2, 3}, {"a", "b", "c"} );
Show( myListVal );

And I see you figured it out too...

Message was edited by: mpb