Returns a closed range that contains both of its bounds.
SDK
- Xcode 9.3+
Framework
- Swift Standard Library
Declaration
static func ... (minimum: Self, maximum: Self) -> ClosedRange <Self>
Parameters
minimumThe lower bound for the range.
maximumThe upper bound for the range.
Discussion
Use the closed range operator (...) to create a closed range of any type that conforms to the Comparable protocol. This example creates a Closed from “a” up to, and including, “z”.
let lowercase = "a"..."z"
print(lowercase.contains("z"))
// Prints "true"