1 // This file was automatically generated from channels.md by Knit tool. Do not edit. 2 package kotlinx.coroutines.guide.exampleChannel02 3 4 import kotlinx.coroutines.* 5 import kotlinx.coroutines.channels.* 6 <lambda>null7fun main() = runBlocking { 8 val channel = Channel<Int>() 9 launch { 10 for (x in 1..5) channel.send(x * x) 11 channel.close() // we're done sending 12 } 13 // here we print received values using `for` loop (until the channel is closed) 14 for (y in channel) println(y) 15 println("Done!") 16 } 17