1. Arrays
  2. Sets
  3. Tuples
  4. Dictionaries
  5. Empty Collections and adding values
  6. Enums
  7. Enum Associated Values
  8. Enum Raw Values

1. Arrays

An Empty array requires an explicit type.

i.e let ar: [Int] = []

var ages: [int] = [23, 45, 67, 82, 1, 23, 43]

this array will contain all integers. For array just type the type of data in square brackets.

Type declaration ⇒ where the data type is mentioned and if any other datais present it will return an error.

Type inference ⇒ where the data type is not mentioned and any data type can be used in an array.

let friend1 = "Saad"
let friend2 = "Ali"
let friend3 = "Ahmed"
let friend4 = "Hasan"
let friend5 = "Kabil"

let friendlist = [friend1, friend2, friend3, friend4, friend5]

print(friendlist[2])

output

Ahmed