How does this function work? <https://github.com/J...
# coroutines
a
How does this function work? https://github.com/JetBrains/kotlin/blob/f093b770e61254673d9e8e2d99678548b9142508/libraries/stdlib/src/kotlin/util/Suspend.kt#L10 I can just run
suspend { .... }
in any code now, without being in a suspending context. How does this work?
👀 1
1
b
No, the code inside won't run. It is just a way to create a lambda similar to how non-suspending one is created:
Copy code
{ println("hello world" } // nothing will be printed, unless you call .invoke() on it
👍 2
a
Ah of course, it is a suspending lambda factory. Makes sense.