---
title: "remove(_:in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsmutablearray/remove(_:in:)"
---

# remove(_:in:)

Removes all occurrences within a specified range in the array of a given object.

## Declaration

```swift
func remove(_ anObject: Any, in range: NSRange)
```

## Parameters

- `anObject`: The object to be removed from the array’s content.
- `range`: The range from which to remove anObject. important: Raises an exception NSRangeException if aRange exceeds the bounds of the array.

## Discussion

Discussion Matches are determined by comparing anObject to the objects in the receiver using the isEqual: method. If the array does not contain anObject within aRange, the method has no effect (although it does incur the overhead of searching the contents).

## See Also

### Removing Objects

- [removeAllObjects()](foundation/nsmutablearray/removeallobjects().md)
- [removeLastObject()](foundation/nsmutablearray/removelastobject().md)
- [remove(_:)](foundation/nsmutablearray/remove(_:).md)
- [removeObject(at:)](foundation/nsmutablearray/removeobject(at:).md)
- [removeObjects(at:)](foundation/nsmutablearray/removeobjects(at:).md)
- [removeObject(identicalTo:)](foundation/nsmutablearray/removeobject(identicalto:).md)
- [removeObject(identicalTo:in:)](foundation/nsmutablearray/removeobject(identicalto:in:).md)
- [removeObjects(fromIndices:numIndices:)](foundation/nsmutablearray/removeobjects(fromindices:numindices:).md)
- [removeObjects(in:)](foundation/nsmutablearray/removeobjects(in:)-4yb26.md)
- [removeObjects(in:)](foundation/nsmutablearray/removeobjects(in:)-1udmn.md)
