Can you use a
for(x:int=0; x<100; x++)
{
var varname+x:Type = (x, something, something);
}
To create one hundred unique variables? Basically I need to make 100 variables and am wondering how you create 100 vats with out resorting to Declaring them all by hand. the problem is var whatever+x just creates a variable with whatever+x instead of creating whatever0, whatever1… to whatever99.
if it helps this is for flash and box2d.
Thanks, Andrew
Yes, try this:
If you make a class
dynamicthen you can assign new properties to it the same way, ie:Implementation:
Obviously you can assign anything you like to these variables.
I’m curious as to why you would want to do this though, you could just create an
Arrayto store 100+ values without assigning them to a variable.