Contents

removeLast(_:)

Removes and discards the specified number of elements from the end of the array.

Declaration

mutating func removeLast(_ k: Int)

Parameters

  • k:

    The number of elements to remove from the array. k must be greater than or equal to zero and must not exceed the count of the array.

Discussion

Attempting to remove more elements than exist in the array triggers a runtime error.