MathGroup Archive 2005

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

Search the Archive

Re: New to Mathematica- How to write functions????????


On 7/21/05 at 3:46 PM, someonekicked at comcast.net (Someonekicked)
wrote:

>new to mathematica, looked at the help, but did not get the help i
>needed..

>I want to write a function that does multiple calculations in its
>body, then it returns a value. I am talking about functions similar
>to functions that you can declare in C++. can anyone give me an
>example?

>in C++, a function would be like, (note int means integer)

>int zzz(int s, int y) {
>int  Q; Q = s*y; 
>return Q;
>}

The Mathematica equivalent to the code above would be

zzz[s_Integer, y_Integer]:=
  Module[{Q},
    Q = s*y;
    Return[Q]
  ]

--
To reply via email subtract one hundred and four


  • Prev by Date: Re: No more memory available.
  • Next by Date: Re: Return[] in pure function
  • Previous by thread: Re: New to Mathematica- How to write functions????????
  • Next by thread: Re: New to Mathematica- How to write functions????????