Re: New to Mathematica- How to write functions????????
- To: mathgroup at smc.vnet.net
- Subject: [mg58889] Re: New to Mathematica- How to write functions????????
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Fri, 22 Jul 2005 01:58:39 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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