Arrays#
Arrays are specialized data structures that hold a list of elements. For example, the following sequence is an array consisting of the numbers one through ten:
Of course, an array doesn't only have to hold numbers. We can for example make an array of words, for example:
Macro arrays#
Warning
In the ImageJ macro language, arrays are only one-dimensional, which means that we cannot represent images as arrays (as opposed to most programming languages). 
Images are, however, represented as...
... Image. 
Unfortunately, in ImageJ macro, we cannot simply initialize an array as we would with any other variable. Instead, to initialize an array in ImageJ Macro, we use the following syntax:
//initialize a new empty array of length 10
my_array1 = newArray(10);
//initialize a new array with the following three elements
my_string_array = newArray("element1", "element2", "element3");
Accessing values in the array#
We can index arrays to determine what values are in them. The simplest form of indexing is asking what the value is at a particular point in the array. Remember that arrays are 0-indexed, meaning the first value is at the 0 position, not at 1. 
To index, we use the following syntax:
For example, if we wanted the first position of my_string_array we would type the following: