Operator 演算子

..<(_:_:)

Returns a half-open range that contains its lower bound but not its upper bound. それの下側の境界は含むがそれの上側の境界はそうしない半開範囲を返します。

Declaration 宣言

Parameters パラメータ

minimum

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

maximum

The upper bound for the range. 範囲の上側の境界。

Discussion 議論

Use the half-open range operator (..<) to create a range of any type that conforms to the Comparable protocol. This example creates a Range<Double> from zero up to, but not including, 5.0. 半開範囲演算子(..<)を使ってComparableプロトコルに準拠する何らかの型の範囲を作成します。この例は、ゼロから5.0までの、しかしそれを含めないRange<Double>を作成します。


let lessThanFive = 0.0..<5.0
print(lessThanFive.contains(3.14))  // Prints "true"
print(lessThanFive.contains(5.0))   // Prints "false"

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