---
title: "~=(_:_:)"
framework: swift
role: symbol
role_heading: Operator
path: "swift/partialrangefrom/~=(_:_:)"
---

# ~=(_:_:)

Returns a Boolean value indicating whether a value is included in a range.

## Declaration

```swift
static func ~= (pattern: Self, value: Self.Bound) -> Bool
```

## Parameters

- `pattern`: A range.

## Discussion

Discussion You can use the pattern-matching operator (~=) to test whether a value is included in a range. The pattern-matching operator is used internally in case statements for pattern matching. The following example uses the ~= operator to test whether an integer is included in a range of single-digit numbers: let chosenNumber = 3 if 0..<10 ~= chosenNumber {     print("\(chosenNumber) is a single digit.") } // Prints "3 is a single digit."
