Hi, is it possible to have a lambda with receiver ...
# getting-started
j
Hi, is it possible to have a lambda with receiver for
fun interface
types when creating them using the lambda syntax? I can't seem to make it work without actually making a concrete class.
Example.kt
y
That's because you're creating the FizzBuzz instance there, and so it won't work. The solution is probably to just remove the
FizzBuzz
receiver
j
@Youssef Shoaib [MOD] Yes that works. Is there anyway to keep the scope though? Removing the receiver makes the function globally available which i was hoping to avoid. Thanks for answering though!
i think i found a solution. thanks!