MathGroup Archive 2009

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

Search the Archive

Re: Return in function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105631] Re: Return in function
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sat, 12 Dec 2009 06:56:19 -0500 (EST)

On 12/11/09 at 6:46 AM, dh at metrohm.com (dh) wrote:

>anonymous function, not only the return value is returned, but also
>"Return" itself. Consider:

>(If[# == 2, Return[a]; #, #]) & /@ {1, 2, 3}

>this gives:

>{1, Return[a], 3}

I get the same result here and this does look like a bug. But
why use this construct at all? It seems to me easier to write:

If[# == 2, a, #]&/@{1, 2, 3}



  • Prev by Date: Animation with Sound in Mathematica?
  • Next by Date: Re: How to Orient Chart Labels Vertically
  • Previous by thread: Re: Return in function
  • Next by thread: Re: Return in function