Instance Method

removeLast()

Removes and returns the last element of the collection.

Declaration

@discardableResult mutating func removeLast() -> Element

Return Value

The last element of the collection.

Discussion

The collection must not be empty. To remove the last element of a collection that might be empty, use the popLast() method instead.

Complexity: O(1)