Removes and returns the last element of the collection.
SDK
- Xcode 8.0+
Framework
- Swift Standard Library
Declaration
@discardableResult mutating func removeLast() -> Self.Element
Available when Self is Sub Sequence.
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 pop method instead.
Complexity: O(1)