https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

dh44t

12/25/2017, 1:16 AM
Silly question, why I can use
ReceivingChannel
in a
for
loop? Is it an iterable? I don't see anything on its hierarchy
l

louiscad

12/25/2017, 1:43 AM
@dh44t Yes, it has the
iterator()
operator that returns a
ChannelIterator
which enables for loop usage. The
forEach
equivalent for ReceiveChannels is
consumeEach
FYI.
👍 1
d

dh44t

12/25/2017, 3:10 PM
Yes, I realise that I can't use
forEach
with was a bit of a shock
d

dave08

12/26/2017, 7:00 PM
In 0.19.3 they added tons of extension functions similar to collections...
5 Views