```/** * You can edit, run, and share this code. ...
# coroutines
a
Copy code
/**
 * You can edit, run, and share this code. 
 * <http://play.kotlinlang.org|play.kotlinlang.org> 
 */

import kotlinx.coroutines.*

fun main() {
    println("Hello, world!!!")
    CoroutineScope(<http://Dispatchers.IO|Dispatchers.IO>).launch {
        (1..1000).forEach {
            suspend {
                delay(2000)
                print("Testing...")
            }
        }
    }
}
What kind of block is
suspend {}
?
e
It is a suspending lamba. Just like
{}
block, but the code can suspend inside. Assign to a variable to use it, like this:
val block = suspend { … }
.
👍 1
a
Got it. Thanks.