<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/AnyBidirectionalCollection/removeFirst(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:Sls11SubSequenceQzRszrlE11removeFirstyySiF::SYNTHESIZED::s:s26AnyBidirectionalCollectionV"
  },
  "title" : "removeFirst(_:)"
}
-->

# removeFirst(_:)

Removes the specified number of elements from the beginning of the
collection.

```
mutating func removeFirst(_ k: Int)
```

## Parameters

`k`

The number of elements to remove. `k` must be greater than
or equal to zero, and must be less than or equal to the number of
elements in the collection.

## Discussion> Complexity: O(1) if the collection conforms to
> `RandomAccessCollection`; otherwise, O(*k*), where *k* is the specified
> number of elements.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)