---
title: length
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsrange-swift.typealias/length
---

# length

The number of items in the range.

## Declaration

```swift
var length: Int
```

## Discussion

Discussion This value can be 0 to represent an empty range. For type compatibility with the rest of the system, the maximum value you should use for length is LONG_MAX.

## See Also

### Accessing range properties

- [location](foundation/nsrange-swift.typealias/location.md)
