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

# add(_:)

Inserts a given object at the end of the array.

## Declaration

```swift
func add(_ anObject: Any)
```

## Parameters

- `anObject`: The object to add to the end of the array’s content. This value must not be nil. important: Raises an NSInvalidArgumentException if anObject is nil.

## See Also

### Related Documentation

- [remove(_:)](foundation/nsmutablearray/remove(_:).md)
- [setArray(_:)](foundation/nsmutablearray/setarray(_:).md)

### Adding Objects

- [addObjects(from:)](foundation/nsmutablearray/addobjects(from:).md)
- [insert(_:at:)](foundation/nsmutablearray/insert(_:at:)-5dbx5.md)
- [insert(_:at:)](foundation/nsmutablearray/insert(_:at:)-73pln.md)
