Sub-routine returning multiple values
10-30-2017, 10:51 AM
Post: #6
 Didier Lachieze Senior Member Posts: 1,563 Joined: Dec 2013
RE: Sub-routine returning multiple values
(10-30-2017 12:48 AM)Jacob Wall Wrote:
Code:
...   my_vars:=Sub_Routine(a,b,c);   d:=my_vars(1);   e:=my_vars(2);   f:=my_vars(3); ... Sub_Routine(x,y,z) BEGIN   RETURN({x+1,y+2,z+3}); END;

It would be handy to be able to reduce the four lines to a single line, some like (d,e,f):=Sub_Routine(a,b,c); or something like that. I haven't fully thought this through yet, but couldn't help thinking there could be a better way.

Any insights or further thought?

You can reduce the four lines to one with:
Code:
...   sto(Sub_Routine(a,b,c),{'d','e','f'}); ...
It's shorter but slower due to the call to a CAS function (sto).

In a CAS program you should be able to do:
Code:
...   {d,e,f}:=Sub_Routine(a,b,c); ...
 « Next Oldest | Next Newest »

 Messages In This Thread Sub-routine returning multiple values - Jacob Wall - 10-30-2017, 12:48 AM RE: Sub-routine returning multiple values - toml_12953 - 10-30-2017, 01:14 AM RE: Sub-routine returning multiple values - cyrille de brĂ©bisson - 10-30-2017, 06:08 AM RE: Sub-routine returning multiple values - StephenG1CMZ - 10-30-2017, 09:00 AM RE: Sub-routine returning multiple values - webmasterpdx - 10-30-2017, 09:15 AM RE: Sub-routine returning multiple values - Didier Lachieze - 10-30-2017 10:51 AM RE: Sub-routine returning multiple values - StephenG1CMZ - 10-30-2017, 06:47 PM RE: Sub-routine returning multiple values - Jacob Wall - 10-31-2017, 02:38 AM

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