Jonathan
02/14/2018, 2:22 PMinterval
function that way.
Calling cancel()
on the ReceiveChannel would interrupt the for loop. So for example interval(500).take(5).consumeEach { println(it) }
would not waste any resource, because the channel will be canceled after the 5th element.