---
title: "contains(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/closedrange/contains(_:)-822cl"
---

# contains(_:)

Returns a Boolean value indicating whether the given closed range is contained within this closed range.

## Declaration

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

## Parameters

- `other`: A closed range to check for containment within this closed range.

## Return Value

Return Value true if other is wholly contained within this closed range; otherwise, false.

## Discussion

Discussion The given closed range is contained within this range if its bounds are contained within this closed range. let range = 0...10 range.contains(2...5)        // true range.contains(2...10)       // true range.contains(2...12)       // false note: O(1)
