Instance Method

removeLast()

Removes and returns the last element of the collection.

Declaration

@discardableResult mutating func removeLast() -> Self.Element
Available when Self is SubSequence.

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)