coerceAtLeast

Ensures that this value is not less than the specified minimumValue.

fun <T : Comparable<T>> T.coerceAtLeast(minimumValue: T): T(source)
fun main() {
    val currentValue = 5
    val minValue = 10

    val coerced = currentValue.coerceAtLeast(minValue)

    println("Original: $currentValue")
    println("Minimum allowed: $minValue")
    println("Coerced result: $coerced") // prints 10
}

Source