Creating a Gosu array

Use square brackets after a type name to create an array. Gosu constrains elements of the array to values or objects of that type. For example, the expression new String[] creates an array of String elements.

Whenever you create an array, you must set its size in terms of a fixed number of elements. You can set the size explicitly by including the number of elements within the square brackets. The following statement explicitly sets the size of a String array to four elements.

var stringArray = new String[4] 

Alternatively, you can set the size of an array implicitly by providing a list of values or objects with which to initialize the array. The size of the array is the number of items in the list. The following statement implicitly sets the size of a String array to four elements.

var stringArray = new String[] {"one", "two", "three", "four"}