something nice I found today, return multiple values from a function

*To*: mathgroup at smc.vnet.net*Subject*: [mg113094] something nice I found today, return multiple values from a function*From*: "Nasser M. Abbasi" <nma at 12000.org>*Date*: Tue, 12 Oct 2010 13:51:45 -0400 (EDT)*Reply-to*: nma at 12000.org

I just found I can duplicate a struct like in Mathematica very easily. This can be used to return multiple values from a function. Much better than just return a list of data items. This is an example: -------------------- getPointCoordinates[] := Module[{x,y}, {x -> 10, y -> 7}] p = getPointCoordinates[]; x = x /. data; y = y /. data; Print["x=", x] Print["y=", y] x=10 y=7 --------------------- Ok, I know the experts here are saying, what is the big deal, we all knew that, but I really did not know I could do that until today. Now I can make my Mathematica code better as before I used to just return a list of the values, and then I had to be careful I access the correct ones by the correct position as they were put in the list by the called function. I never liked having to do that. The above is so much better. I keep learning new things about Mathematica every day. Amazing. --Nasser