---
title: "removeFirst(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/array/removefirst(_:)"
---

# removeFirst(_:)

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

## Declaration

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

## Parameters

- `k`: The number of elements to remove from the collection. k must be greater than or equal to zero and must not exceed the number of elements in the collection.

## Discussion

Discussion var bugs = ["Aphid", "Bumblebee", "Cicada", "Damselfly", "Earwig"] bugs.removeFirst(3) print(bugs) // Prints "["Damselfly", "Earwig"]" Calling this method may invalidate any existing indices for use with this collection. note: O(n), where n is the length of the collection.

## See Also

### Removing Elements

- [remove(at:)](swift/array/remove(at:).md)
- [removeFirst()](swift/array/removefirst().md)
- [removeLast()](swift/array/removelast().md)
- [removeLast(_:)](swift/array/removelast(_:).md)
- [removeSubrange(_:)](swift/array/removesubrange(_:)-8may1.md)
- [removeSubrange(_:)](swift/array/removesubrange(_:)-9twou.md)
- [removeAll(where:)](swift/array/removeall(where:)-5k61r.md)
- [removeAll(keepingCapacity:)](swift/array/removeall(keepingcapacity:).md)
- [popLast()](swift/array/poplast().md)
