https://kotlinlang.org logo
#announcements
Title
# announcements
s

s4nchez

05/16/2017, 8:14 PM
@nkiesel True. Class would be more useful only if you had more logic to be done inside that function. Those could be defined as other private functions encapsulated inside that class.
n

nkiesel

05/16/2017, 9:11 PM
s4nchez: not denying that there might be some use to extend lambdas, but your "function" could of course also be done due to "local functions":
Copy code
fun myLambda(name: String): () -> Unit = {
    fun p(n: String) {
        println("Hello, $n")
    }
    p(name)
}
👍 2