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.
ages.count ⇒ will return the number of elements in an array.
.first ⇒ returns first element
.last ⇒ returns last element
.min ⇒ returns minimum element
.max ⇒ returns maximum element
.append ⇒ adds data into array
.insert ⇒ add data into and index of an array
.sort ⇒ automatically sorts an array
.sorted ⇒ if sorting an array inside a declared variable
.reverse ⇒ reversing the order or array
.shuffle ⇒ basically shuffling an array interchanging the indexes of values