Contents

==(_:_:)

Returns a Boolean value indicating whether two ranges are equal.

Declaration

static func == (lhs: ClosedRange<Bound>, rhs: ClosedRange<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.

let x = 5...15
print(x == 5...15)
// Prints "true"
print(x == 10...20)
// Prints "false"

See Also

Comparing Ranges