rangeTo

operator fun <T : Comparable<T>> T.rangeTo(that: T): ClosedRange<T>(source)

Creates a range from this Comparable value to the specified that value.

This value needs to be smaller than or equal to that value, otherwise the returned range will be empty.

Since Kotlin

1.0

Samples


Creates a range from this Double value to the specified that value.

Numbers are compared with the ends of this range according to IEEE-754.

Since Kotlin

1.1

Samples


Creates a range from this Float value to the specified that value.

Numbers are compared with the ends of this range according to IEEE-754.

Since Kotlin

1.1

Samples