Operator

==(_:_:)

Returns a Boolean value indicating whether two ranges are equal.

Declaration

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"

Relationships

From Protocol

See Also

Comparing Ranges

static func != (Range<Bound>, Range<Bound>) -> Bool

Returns a Boolean value indicating whether two values are not equal.

func overlaps(Range<Bound>) -> Bool

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

func overlaps(ClosedRange<Bound>) -> Bool

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