---
title: "remove(at:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/contiguousarray/remove(at:)"
---

# remove(at:)

Removes and returns the element at the specified position.

## Declaration

```swift
@discardableResult mutating func remove(at index: Int) -> Element
```

## Parameters

- `index`: The position of the element to remove. index must be a valid index of the array.

## Return Value

Return Value The element at the specified index.

## Discussion

Discussion All the elements following the specified position are moved up to close the gap. var measurements: [Double] = [1.1, 1.5, 2.9, 1.2, 1.5, 1.3, 1.2] let removed = measurements.remove(at: 2) print(measurements) // Prints "[1.1, 1.5, 1.2, 1.5, 1.3, 1.2]" note: O(n), where n is the length of the array.
