Operator 演算子

...(_:_:)

Returns a closed range that contains both of its bounds. それの境界の両方を含む完結範囲を返します。

Declaration 宣言

Parameters パラメータ

minimum

The lower bound for the range. 範囲の下側の境界。

maximum

The 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 ClosedRange<Character> from “a” up to, and including, “z”. 完結範囲演算子(...)を使うことでComparableプロトコルに準拠する何らかの型の配列を作成してください。この例は、「a」から「z」までの、そしてそれを含むClosedRange<Character>を作成します。


let lowercase = "a"..."z"
print(lowercase.contains("z"))
// Prints "true"

Precondition: minimum <= maximum. 前提条件:minimum <= maximum