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

MathGroup Archive 1997

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

Search the Archive

Re: Static variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9339] Re: Static variables
  • From: Hein Hundal <junkmail at vicon.net>
  • Date: Sat, 1 Nov 1997 03:33:25 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Try wrapping your function in a module with the required static
variables.  Below staticSum is static and local to the function
cumaulativesum.

Module[{staticSum},
   staticSum = 0;
   cumulativesum[x_] := staticSum += x ]

Table[cumulativesum[i], {i,10}]


Hein Hundal
send replies to hundal at vicon.net


  • Prev by Date: headers and footers again
  • Next by Date: Release question
  • Previous by thread: RE: Headers and footers again
  • Next by thread: Re: Static variables