#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# Array Full of Numbers

Why is it that Processing does not like the arrays to be put like this?

``````int[] NE = new int;
NE = 60000;
NE = 55000;
NE = 45000;
NE = 46000;

int[] ND = new int;
ND = 80000;
ND = 70000;
ND = 40000;
ND = 45000;

int[] F = new int;
F = 60000;
F = 35000;
F = 24000;
F = 28000;

int[] M = new int;
M = 120000;
M = 100000;
M = 110000;
M = 100000;
``````
Tagged:

• edited April 2015 Answer ✓

Your posted code works perfectly. And it's running in Processing's "static mode" now.
See the section "Hello Mouse" at the link below to know about static & interactive modes:
https://processing.org/tutorials/overview/

Now if you change it for the regular "interactive mode" it's not gonna work the way it is now.
Not b/c of Processing, but Java's!

In the section where we declare the class' fields, outside of any of its methods, regular statements aren't allowed! For example: `NE = 60000;`
However, if you really wish to run non-declaration statements there, we can place them inside a curly brace block:

``````final int[] NE = new int;
{
NE = 60000;
NE = 55000;
NE = 45000;
NE = 46000;
}
``````

But I particularly would go w/ this simpler form:

`static final int[] NE = {60000, 55000, 45000, 46000};`

• Everything GotoLoop has said is correct but the following code shows 2 alternative ways of doing what you want

Verbose Code

``````int[] NE = new int;
int[] ND = new int;
int[] F = new int;
int[] M = new int;

void setup() {
NE = 60000;
NE = 55000;
NE = 45000;
NE = 46000;

ND = 80000;
ND = 70000;
ND = 40000;
ND = 45000;

F = 60000;
F = 35000;
F = 24000;
F = 28000;

M = 120000;
M = 100000;
M = 110000;
M = 100000;
}
``````

Less verbose code

``````int[] NE, ND, F, M;

void setup() {
NE = new int[] { 60000, 55000, 45000, 46000 };
ND = new int[] { 80000, 70000, 40000, 45000 };
F  = new int[] { 60000, 35000, 24000, 28000 };
M  = new int[] { 12000, 10000, 11000, 10000 };
}
``````