---
title: iterateObjects
framework: driverkit
role: symbol
role_heading: Instance Method
path: driverkit/osarray/iterateobjects
---

# iterateObjects

Iterates the array calling a callback block for each member.

## Declaration

```occ
virtual bool iterateObjects(OSCollectionIterateObjectsBlock block) const;
```

## Parameters

- `block`: The block to invoke.

## Return Value

Return Value False if the callback block returned false, otherwise true (including if the array is empty).

## Discussion

Discussion Calls the block with each member of the array, starting at index zero. The block must not modify the array during iteration. If the block returns true the iteration continues for all members, returning false halts the iteration early.

## See Also

### Accessing Elements

- [getObject](driverkit/osarray/getobject.md)
- [getLastObject](driverkit/osarray/getlastobject.md)
- [getNextIndexOfObject](driverkit/osarray/getnextindexofobject.md)
- [setObject](driverkit/osarray/setobject-3bore.md)
- [setObject](driverkit/osarray/setobject-4ys3x.md)
- [replaceObject](driverkit/osarray/replaceobject.md)
- [removeObject](driverkit/osarray/removeobject.md)
- [OSArrayAppendValue](driverkit/osarrayappendvalue.md)
- [OSArrayReplaceValue](driverkit/osarrayreplacevalue.md)
