The dropLastWhile function accepts a lambda expression. This function keeps ignoring the elements from the end of the list until the condition is satisfied:
newList = numbers.dropLastWhile { it > 5 }
println("Drop from end : while element is greater than 5")
println(newList)