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

# adding(_:)

Returns a new array that is a copy of the receiving array with a given object added to the end.

## Declaration

```swift
func adding(_ anObject: Any) -> [Any]
```

## Parameters

- `anObject`: An object.

## Return Value

Return Value A new array that is a copy of the receiving array with anObject added to the end.

## Discussion

Discussion If anObject is nil, an NSInvalidArgumentException is raised.

## See Also

### Related Documentation

- [add(_:)](foundation/nsmutablearray/add(_:).md)

### Deriving New Arrays

- [addingObjects(from:)](foundation/nsarray/addingobjects(from:).md)
- [filtered(using:)](foundation/nsarray/filtered(using:).md)
- [subarray(with:)](foundation/nsarray/subarray(with:).md)
