---
title: "overlaps(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/closedrange/overlaps(_:)-7dfep"
---

# overlaps(_:)

Returns a Boolean value indicating whether this range and the given closed range contain an element in common.

## Declaration

```swift
func overlaps(_ other: ClosedRange<Bound>) -> Bool
```

## Parameters

- `other`: A range to check for elements in common.

## Return Value

Return Value true if this range and other have at least one element in common; otherwise, false.

## Discussion

Discussion This example shows two overlapping ranges: let x: Range = 0...20 print(x.overlaps(10...1000)) // Prints "true"

## See Also

### Comparing Ranges

- [==(_:_:)](swift/closedrange/==(_:_:).md)
- [!=(_:_:)](swift/closedrange/!=(_:_:).md)
- [overlaps(_:)](swift/closedrange/overlaps(_:)-947dt.md)
