floorDiv
Divides this value by the other value, flooring the result to an integer that is closer to negative infinity.
For unsigned types, the results of flooring division and truncating division are the same.
Since Kotlin
1.5Samples
import kotlin.test.assertFailsWith
fun main() {
//sampleStart
// Unsigned types have no negative values, so floorDiv produces the
// same result as the / operator
println(7u.floorDiv(3u)) // 2
println(7u / 3u) // 2
// Dividing by zero throws
// 1u.floorDiv(0u) // will fail with ArithmeticException
//sampleEnd
}Content copied to clipboard