fun lambdaReturn1(word: String): () -> String = { word + word }
Function Call | Return Value | |||
---|---|---|---|---|
lambdaReturn1("hello").invoke() | → | |||
lambdaReturn1("hi")() | → | |||
{ lambdaReturn1("there")() }.invoke() | → | |||
{ lambdaReturn1("world").invoke() }() | → |
Experiment with this code on Gitpod.io or as a Kotlin Playground