---
title: endIndex
framework: realitykit
role: symbol
role_heading: Instance Property
path: realitykit/scene/anchorcollection/endindex
---

# endIndex

The position one greater than the last valid subscript argument.

## Declaration

```swift
@MainActor @preconcurrency var endIndex: Int { get }
```

## Discussion

Discussion When you need a range that includes the last element of an array, use the half-open range operator (..<) with endIndex. The ..< operator creates a range that doesn’t include the upper bound, so it’s safe to use with endIndex. If the array is empty, endIndex is equal to startIndex.

## See Also

### Manipulating indices

- [Scene.AnchorCollection.Index](realitykit/scene/anchorcollection/index.md)
- [startIndex](realitykit/scene/anchorcollection/startindex.md)
- [index(after:)](realitykit/scene/anchorcollection/index(after:).md)
