limitTo

fun Float.limitTo(min: Float, max: Float): Float

Limits the float value to the given range.

Parameters

min

The minimum value.

max

The maximum value.


fun Int.limitTo(min: Int, max: Int): Int

Deprecated

This function is deprecated and will be removed in the future. Use `kotlin.ranges.coerceIn` instead.

Replace with

this.coerceIn(min, max)

Limits the integer value to the given range.

Parameters

min

The minimum value.

max

The maximum value.