2 05 Collections
2 05 Collections
Collections
Collection types
Array
Dictionary
Arrays
Defining
[value1, value2, value3]
There is a 5
Array types
if myArray.isEmpty { }
Working with arrays
Accessing or setting a specific item
var names = ["Anne", "Gary", "Keith"]
let firstName = names[0]
print(firstName)
Anne
names[1] = "Paul"
print(names)
["Amy", "Brad"]
names.removeAll()
print(names)
[]
Working with arrays
scores["Oli"] = 399
scores["Oli"] = 399
400