Is it possible to assign lambdas to a variable wit...
# getting-started
b
Is it possible to assign lambdas to a variable with functional (SAM) interface type? E.g.
Copy code
fun interface Foo {
    fun bar(): Unit
}
val x: Foo = { println("Auto Lambda-to-SAM conversion") }
Oh, I forgot I had to prefix it with the correct type:
val x: Foo = Foo { println("Auto Lambda-to-SAM conversion") }
👍 2