Instance Method


Removes and returns the last element of the collection.


mutating func popLast() -> Element?

Return Value

The last element of the collection if the collection has one or more elements; otherwise, nil.


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.

Complexity: O(1)