To send an element through the channel, you must use the function send(), as we saw previously. This is a suspending function that will suspend the sender if the buffer is full in the case of a buffered channel, and will suspend until receive() is called if it's a RendezvousChannel:
val channel = Channel<Int>(1)
channel.send(1)
The send() function will throw a ClosedChannelException if the channel is closed:
val channel = Channel<Int>(1)
channel.close()
channel.send(1) // ClosedChannelException is thrown