Creating a lot of variables

#1

Hi,
I need to create a lot of variables with the same name, but with different numbers after the name, like that(obviously doesn’t work):

void setup(){
  for(int i = 10;i>=0;i--){
    int "var" + char(i);
  }
}

What can i use to accomplish this task?

1 Like
#2

just not do it!
how about using a array or a array list to keep that data?
https://processing.org/reference/Array.html
https://processing.org/reference/ArrayList.html

3 Likes
#3

I actually forgot that there are such things as arrays, thanks!

1 Like