removeLast
Removes the last element from this mutable list and returns that removed element, or throws NoSuchElementException if this list is empty.
@IgnorableReturnValuefun <T> MutableList<T>.removeLast(): T(source)
fun main() {
val fruits = mutableListOf("apple", "banana", "cherry")
val removed = fruits.removeLast()
println("Removed element: $removed") // cherry
println("List after removal: $fruits") // [apple, banana]
}