string - java Loop through variables with a common name -
i'm trying create 10 variables random numbers, beginning same word, like:
- foo1
- foo2
- foo3
- foo4
what i'm trying is:
for(int = 0; < 20; += i){ int name = int("foo" + i) name = random(100, 500); image(blabla, blabla, name); //the blabla fixed coordinates };
cannot work.
guys know how solve this?
thanks in advance!
you use array.
an array variable holds multiple values.
int[] r = {1, 2, 3}; int x = r[0];
here processing array reference.
here how might in example:
pimage[] images = new pimage[20]; images[0] = loadimage(...); //..load rest of images for(int = 0; < 20; += i){ image(blabla, blabla, images[i]); }
Comments
Post a Comment