We will demonstrate lambda-expression syntax with the following example:
val x = { a: Int, b: Int -> a + b }
println(x.invoke(2, 4))
Console output:
6
Then, the same thing in different way:
val x: (Int, Int) -> Int = { a, b -> a + b }
println(x.invoke(2, 4))
Console output:
6