---
title: RangeExpression
framework: swift
role: symbol
role_heading: Protocol
path: swift/rangeexpression
---

# RangeExpression

A type that can be used to slice a collection.

## Declaration

```swift
protocol RangeExpression<Bound>
```

## Overview

Overview A type that conforms to RangeExpression can convert itself to a Range<Bound> of indices within a given collection.

## Topics

### Operators

- [~=(_:_:)](swift/rangeexpression/~=(_:_:).md)

### Associated Types

- [Bound](swift/rangeexpression/bound.md)

### Instance Methods

- [contains(_:)](swift/rangeexpression/contains(_:).md)
- [relative(to:)](swift/rangeexpression/relative(to:).md)

## Relationships

### Conforming Types

- [ClosedRange](swift/closedrange.md)
- [PartialRangeFrom](swift/partialrangefrom.md)
- [PartialRangeThrough](swift/partialrangethrough.md)
- [PartialRangeUpTo](swift/partialrangeupto.md)
- [Range](swift/range.md)

## See Also

### Range Expressions

- [PartialRangeUpTo](swift/partialrangeupto.md)
- [PartialRangeThrough](swift/partialrangethrough.md)
- [PartialRangeFrom](swift/partialrangefrom.md)
- [UnboundedRange_](swift/unboundedrange_.md)
