create series of arrays in a loop

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

create series of arrays in a loop

dcsaba
Dear Members,

i have tried to create a series of arrays with names containing a string and a number. Could someone explain me, why is it not workin, and how can it be corrected?

here is my attempt:

nevTomb=newArray(0);
szam=1;
String.resetBuffer // Resets (clears) the buffer.
for (i=1;i<5;i++){
//creates a name
neve="thr"+i;
//adds name to name list
nevTomb=Array.concat(nevTomb, neve);
//creates a new array with this name
eval(neve+"=newArray(0);");

String.append(", "+ neve) // Appends str to the buffer.

for (j=0;j<2;j++){
        //concatenats an increasing number to the actual array
        //(filling the arrays with values)
        eval(neve+"=Array.concat("+neve+","+szam+");");
        szam=szam+1;
       
}//j

}//i

ns=String.buffer // Returns the contents of the buffer.
print(ns);

//shows all the arrays
eval("Array.show(\"Névsor\""+ns+");");



Many thanks in advance!
Csaba