When creating an array, we need to specify the type of the elements that we will be storing in the array; this is declared in angular brackets as part of the array's type declaration:
var moviesToWatch: Array<String> = Array() moviesToWatch.append("The Shawshank Redemption") moviesToWatch.append("Ghostbusters") moviesToWatch.append("Terminator 2")
This uses a language feature called generics, which we will cover in detail in Chapter 4, Generics, Operators, and Nested Types.
The append method on the array will add a new element to the end of the array. Now that we have put some elements in the array, let's access those elements:
print(moviesToWatch[0]) // "The Shawshank Redemption" print(moviesToWatch[1]) // "Ghostbusters" ...