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 *)
- References:
- Null Return for a Module
- From: Dave the Funkatron <dave.rudolf@usask.ca>
- Null Return for a Module