Adding numbers in an empty array in Processing 3.5.3


I am trying to code a rythm game in Processing. Since then I was coding in OpenProcessing but in order to import songs, I had to change the application.

I had to make a list of 600 integer. To make the program more fonctionnal I decided to use a for loop like this :

int[] list;
for (i=0 ; i<600; i++) {
	int[] list = append (list, 0);

The problem is, this part of code works on OpenProcessing but doesn’t works on the app 3.5.3.

I heard the problem was that the for loop only works on a void function. I also want this array to be used in different void functions.

I would be happy if anyone can give me a solution.

final int[] arr = new int[600];

1 Like

Thank you for your reply but I’ve tried to do it on my whole programm and I have the error message “The final field rythm.list cannot be assigned”.

Then, remove the keyword final from the variable declaration: int[] arr = new int[600];

Also, some extra array tips:

1 Like