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