popLast()
Removes and returns the last element of the collection.
Declaration
mutating func popLast() -> Self.Element?Return Value
The last element of the collection if the collection has one or more elements; otherwise, nil.
Discussion
You can use popLast() to remove the last element of a collection that might be empty. The removeLast() method must be used only on a nonempty collection.