MathGroup Archive 2008

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

Search the Archive

Re: Null Return for a Module

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88715] Re: [mg88666] Null Return for a Module
  • From: "W_Craig Carter" <ccarter at mit.edu>
  • Date: Tue, 13 May 2008 07:12:02 -0400 (EDT)
  • References: <200805120845.EAA21262@smc.vnet.net>

Hello Dave the Funkatron,
I believe you have a missing ";"
Try

Test[] := Module[{i, thesum}, thesum = 0;
  For[i = 1, i <= 3, i++, thesum = thesum + i] ;
  Return[thesum]]

Test[]

On Mon, May 12, 2008 at 4:45 AM, Dave the Funkatron
<dave.rudolf at usask.ca> wrote:
> Hi all,
>
>  I'm getting strange output and am trying to track down what might be
>  causing it. I have the following code in my .nb file:
>
>  (* begin code *)
>
>  Test[ ] := Module[ {i, thesum},
>         thesum = 0;
>         For[ i = 1, i <= 3, i++,
>                 thesum = thesum + i
>         ]
>          Return[ thesum  ]
>   ]
>
>  Test[ ]
>
>  (* end code *)


  • Prev by Date: SetOptions[Plot, BaseStyle :> myBaseStyle] does not work
  • Next by Date: Re: graphic text style setting
  • Previous by thread: Null Return for a Module
  • Next by thread: Re: Null Return for a Module