<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Range/==(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Operator",
  "symbol" : {
    "kind" : "Operator",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:Sn2eeoiySbSnyxG_ABtFZ"
  },
  "title" : "==(_:_:)"
}
-->

# ==(_:_:)

Returns a Boolean value indicating whether two ranges are equal.

```
static func == (lhs: Range<Bound>, rhs: Range<Bound>) -> Bool
```

## Parameters

`lhs`

A range to compare.

`rhs`

Another range to compare.

## Discussion

Two ranges are equal when they have the same lower and upper bounds.
That requirement holds even for empty ranges.

```
let x = 5..<15
print(x == 5..<15)
// Prints "true"

let y = 5..<5
print(y == 15..<15)
// Prints "false"
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)