Re: Re: multiple outputs from a function
- To: mathgroup at smc.vnet.net
- Subject: [mg52851] Re: [mg52802] Re: [mg52753] multiple outputs from a function
- From: "David Annetts" <davidannetts at ihug.com.au>
- Date: Tue, 14 Dec 2004 06:00:38 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Insofar as Mathematica is concerned, no, it is not needed. Indeed, as others have pointed out, the entire Module[] can also be avoided. As a clear statement that a list (or any other variable) is returned from a Module[] or Block[], it is invaluable. In my experience, simple defensive things like this save hours (or worse) trying to debug code. Leave it out if you want. Dave. > -----Original Message----- > From: DrBob [mailto:drbob at bigfoot.com] To: mathgroup at smc.vnet.net > Sent: Tuesday, 14 December 2004 07:55 > To: David Annetts; mathgroup at smc.vnet.net > Subject: [mg52851] Re: [mg52802] Re: [mg52753] multiple outputs from a function > > Return is almost never needed, certainly not in this kind of function: > > stats[x_List] := Module[{local variables}, > (* function body *); > {mean, variance, std} > ]; > > Bobby -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.296 / Virus Database: 265.5.2 - Release Date: 13/12/2004