kotlin.ranges.rangeTo

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.