Operator 演算子

...(_:)

Returns a partial range extending upward from a lower bound. 下側の境界から上方に拡張している部分的な範囲を返します。

Declaration 宣言

postfix static func ... (minimum: UInt8) -> PartialRangeFrom<UInt8>

Parameters パラメータ

minimum

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

Discussion 解説

Use the postfix range operator (postfix ...) to create a partial range of any type that conforms to the Comparable protocol. This example creates a PartialRangeFrom<Double> instance that includes any value greater than or equal to 5.0. 後置完結範囲演算子(後置...)を使うことで何らかの型の部分的な範囲でComparableプロトコルに準拠するものを作成してください。この例は、PartialRangeFrom<Double>インスタンスで5.0より大きいか等しい何らかの値を含むものを作成します。


let atLeastFive = 5.0...


atLeastFive.contains(4.0)     // false
atLeastFive.contains(5.0)     // true
atLeastFive.contains(6.0)     // true

You can use this type of partial range of a collection’s indices to represent the range from the partial range’s lower bound up to the end of the collection. あなたは、あるコレクションのインデックスからなる、この型の部分的範囲を使うことで、その部分的な範囲の下側の境界からそのコレクションの終わりまでの範囲を表すことができます。


let numbers = [10, 20, 30, 40, 50, 60, 70]
print(numbers[3...])
// Prints "[40, 50, 60, 70]"

Precondition: minimum must compare equal to itself (i.e. cannot be NaN). 前提条件:minimumはそれ自身と等しいと比較されなければなりません(すなわちNaNであることはできません)。