1 // This file was automatically generated from channels.md by Knit tool. Do not edit.
2 package kotlinx.coroutines.guide.exampleChannel01
3 
4 import kotlinx.coroutines.*
5 import kotlinx.coroutines.channels.*
6 
<lambda>null7 fun main() = runBlocking {
8     val channel = Channel<Int>()
9     launch {
10         // this might be heavy CPU-consuming computation or async logic,
11         // we'll just send five squares
12         for (x in 1..5) channel.send(x * x)
13     }
14     // here we print five received integers:
15     repeat(5) { println(channel.receive()) }
16     println("Done!")
17 }
18