---
title: lastIndex
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsindexset/lastindex
---

# lastIndex

The last index in the index set.

## Declaration

```swift
var lastIndex: Int { get }
```

## Discussion

Discussion Last index in the index set or NSNotFound when the index set is empty.

## See Also

### Getting Indexes

- [firstIndex](foundation/nsindexset/firstindex.md)
- [indexLessThanIndex(_:)](foundation/nsindexset/indexlessthanindex(_:).md)
- [indexLessThanOrEqual(to:)](foundation/nsindexset/indexlessthanorequal(to:).md)
- [indexGreaterThanOrEqual(to:)](foundation/nsindexset/indexgreaterthanorequal(to:).md)
- [indexGreaterThanIndex(_:)](foundation/nsindexset/indexgreaterthanindex(_:).md)
- [getIndexes(_:maxCount:inIndexRange:)](foundation/nsindexset/getindexes(_:maxcount:inindexrange:).md)
