We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Local Variable lifespan
Page Index Toggle Pages: 1
Local Variable lifespan (Read 301 times)
Local Variable lifespan
Sep 25th, 2006, 10:05pm
 
Does a local variable get killed after the funtion returns?  I assume so since I cant make it static.  Sorry if this is in the docs I didnt see it.
Re: Local Variable lifespan
Reply #1 - Sep 26th, 2006, 12:08am
 
Local variables cease to be, when they go out of scope. So if you create it at the start of a function then it ceases to exist at the end of the function. If you create it inside a for loop, it only exists within the for loop.
Re: Local Variable lifespan
Reply #2 - Sep 26th, 2006, 12:29am
 
nice,  I was beginning to wonder about recreating vars in functions called thousands of times per second.

thanks JohnG!
Page Index Toggle Pages: 1