---
title: "extracting(droppingLast:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/span/extracting(droppinglast:)"
---

# extracting(droppingLast:)

Returns a span over all but the given number of trailing elements.

## Declaration

```swift
func extracting(droppingLast k: Int) -> Span<Element>
```

## Parameters

- `k`: The number of elements to drop off the end of the span. k must be greater than or equal to zero.

## Return Value

Return Value A span leaving off the specified number of elements at the end.

## Discussion

Discussion If the number of elements to drop exceeds the number of elements in the span, the result is an empty span. The returned span’s first item is always at offset 0; unlike buffer slices, extracted spans do not share their indices with the span from which they are extracted. note: O(1)
