show array elements from last to the first swift code example
Example 1: how to get the last element of an array in swift
if let last = a.last {
print(last)
}
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)