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 › using loop counter in variable new name
Page Index Toggle Pages: 1
using loop counter in variable new name (Read 538 times)
using loop counter in variable new name
Dec 20th, 2008, 7:59pm
 
coming from flash..
having a hard time doing something like this in processing.

for(int i=0; i<10; i++){
 
 _root["myVar" + i] = 1;

}
Re: using loop counter in variable new name
Reply #1 - Dec 20th, 2008, 8:03pm
 
Stupid question: why do you want to do that, instead of using a regular array?

Perhaps you are taking the problem from the wrong side...

In short: there is no way to do this in a simple fashion. But there are lot of workarounds/alternate solutions.
Re: using loop counter in variable new name
Reply #2 - Dec 20th, 2008, 8:31pm
 
thanks for the motivation...

found my way.
Page Index Toggle Pages: 1