# Adding numbers in an empty array in Processing 3.5.3

**URL:** <https://discourse.processing.org/t/adding-numbers-in-an-empty-array-in-processing-3-5-3/10496>\
**Category:** Beginners\
**Created:** [April 20, 2019, 3:15pm UTC](https://discourse.processing.org/t/adding-numbers-in-an-empty-array-in-processing-3-5-3/10496 "2019-04-20T15:15:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TambourMagique](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TambourMagique](https://discourse.processing.org/u/TambourMagique)\
**Post date:** [April 20, 2019, 3:15pm UTC](https://discourse.processing.org/t/adding-numbers-in-an-empty-array-in-processing-3-5-3/10496/1 "2019-04-20T15:15:52Z")

</div>

Hello,

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 :

```auto
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.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [April 20, 2019, 3:20pm UTC](https://discourse.processing.org/t/adding-numbers-in-an-empty-array-in-processing-3-5-3/10496/2 "2019-04-20T15:20:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TambourMagique](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@TambourMagique](https://discourse.processing.org/u/TambourMagique)\
**Post date:** [April 20, 2019, 3:30pm UTC](https://discourse.processing.org/t/adding-numbers-in-an-empty-array-in-processing-3-5-3/10496/3 "2019-04-20T15:30:07Z")

</div>

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”.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [April 20, 2019, 3:34pm UTC](https://discourse.processing.org/t/adding-numbers-in-an-empty-array-in-processing-3-5-3/10496/4 "2019-04-20T15:34:17Z")

</div>

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

Also, some extra array tips:

> [@Array expand doesn't always work?](https://discourse.processing.org/t/array-expand-doesnt-always-work/10410/2):
>
> Java [arrays](https://processing.org/reference/Array.html) can’t have its length changed once created. coffee What [expand()](https://processing.org/reference/expand_.html) and other similar functions do is create another array w/ a diff. length, copy the contents of the original array to the new 1, and then return the new 1. face_with_monocle So we do need to store the newly returned array to some variable. flushed That’s why an ArrayList, or in your particular case a StringList, is a much better choice as a dynamic length container: bulb[Processing.org/reference/ArrayList.ht…](http://Processing.org/reference/ArrayList.html)
