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

# removeFirst()

Removes and returns the first element of the collection.

## Declaration

```swift
@discardableResult mutating func removeFirst() -> Self.Element
```

## Return Value

Return Value The removed element.

## Discussion

Discussion The collection must not be empty. var bugs = ["Aphid", "Bumblebee", "Cicada", "Damselfly", "Earwig"] bugs.removeFirst() print(bugs) // Prints "["Bumblebee", "Cicada", "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)
