Contents

contains(_:)

Returns a Boolean value indicating whether the given element is contained within the range.

Declaration

func contains(_ element: Bound) -> Bool

Parameters

  • element:

    The element to check for containment.

Return Value

true if element is contained in the range; otherwise, false.

Discussion

A ClosedRange instance contains both its lower and upper bound. element is contained in the range if it is between the two bounds or equal to either bound.