First page Back Continue Last page Graphics
Array Declaration
An Array in Processing
- looks a like a regular variable, but is declared using the brackets “[ ]” to denote that it is an a list, rather then a single variables
- can hold any type of data ... ints, floats, colors, etc ...
- ex: float [ ] pos; color [ ] rainbow; ... etc
- must be initialized with the new command, which tells Processing how many variables are in the array
- ex: int [ ] numbers = new int[3];
- the elements in the list are indexed from 0 to the length-1
- ex: int[0] = 0; // means the first element is = 0
- has a built in value that returns the length of the array
- number.length // returns an int numebr of elements in the array