Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

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
 


  • Prev by Date: Re: scroll problem with mouse
  • Next by Date: Re: Remove the higher order terms in series expansion
  • Previous by thread: Re: multiple outputs from a function
  • Next by thread: Re: multiple outputs from a function