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 › ["output"+i] = createWriter("code_sort"+i+".txt")
Page Index Toggle Pages: 1
["output"+i] = createWriter("code_sort"+i+".txt") (Read 425 times)
["output"+i] = createWriter("code_sort"+i+".txt")
Nov 7th, 2009, 7:13am
 
is something like:
["output"+i] = createWriter("code_sort"+i+".txt");
possible?

Code:

PrintWriter output1, output2, output3, output4, output5;

void setup(){
for (int i = 0; i < 5; i++){
["output"+i] = createWriter("code_sort"+i+".txt");
}
}
Re: ["output"+i] = createWriter("code_sort"+i+".txt")
Reply #1 - Nov 7th, 2009, 7:23am
 
Creative syntax? It is possible in some languages but not in Java.
You should use an array.
Page Index Toggle Pages: 1