MathGroup Archive 2008

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

Search the Archive

Re: Null Return for a Module


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