Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

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


  • 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????????