maxOrNull
Returns the largest element or null if the array is empty.
fun Array<out Double>.maxOrNull(): Double?(source)
val numbers = arrayOf(3.5, 7.2, 1.9, 9.4)
val maxValue: Double? = numbers.maxOrNull()
println(maxValue ?: "Array is empty")
Returns the largest element or null if the array is empty.
fun Array<out Double>.maxOrNull(): Double?(source)
val numbers = arrayOf(3.5, 7.2, 1.9, 9.4)
val maxValue: Double? = numbers.maxOrNull()
println(maxValue ?: "Array is empty")