W3cubDocs

/Kotlin

rangeTo

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

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

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

operator fun Double.rangeTo(
    that: Double
): ClosedFloatingPointRange<Double>

Platform and version requirements: Kotlin 1.1

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

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

operator fun Float.rangeTo(
    that: Float
): ClosedFloatingPointRange<Float>

Platform and version requirements: Kotlin 1.1

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

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

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.ranges/range-to.html