The filter function takes a lambda expression that takes one variable type as an input and returns a result. If the lambda expression deals with a single variable, it can be represented with the it keyword. We can write a filter that can filter out all the even numbers, as follows:
newList = numbers.filter { it % 2 == 0 }
println("Filter out Even numbers")
println(newList)
Instead of writing i-> i % 2 == 0, we can directly write it as % 2 == 0, which can handle everything by itself.