get the last number in an aray code example
Example 1: how to get last element of array
return array[array.length - 1];
Example 2: how to get last element of an array in swifg
let myArray = ["Hello!", "World!"]
let capacity = myArray.count
let lastElement = myArray[capacity-1]
print(lastElement)