Instance Property

isEmpty

A Boolean value indicating whether the range contains no elements.

Declaration

var isEmpty: Bool { get }

Discussion

An empty Range instance has equal lower and upper bounds.

let empty: Range = 10..<10
print(empty.isEmpty)
// Prints "true"

Relationships

From Protocol

See Also

Inspecting a Range

var count: Int

The number of elements in the collection.

let lowerBound: Bound

The range’s lower bound.

let upperBound: Bound

The range’s upper bound.