lastOrNull
Returns the last element, or null if the array is empty.
fun <T> Array<out T>.lastOrNull(): T?(source)
fun main() {
val words = arrayOf("apple", "banana", "cherry")
println(words.lastOrNull()) // Output: cherry
val empty = arrayOf<String>()
println(empty.lastOrNull()) // Output: null
}