Course of Raku / Functional, concurrent, reactive, and web programming / Concurrent programming / Channels / Sending and receiving

Quiz — Channels

What does the following program print?

my $c = Channel.new;
$c.send(10);
$c.send(20);
say $c.receive;
110
020
030
0(10 20)

A channel is a first-in, first-out queue. 10 was sent first, so the first .receive returns 10.

Course navigation

Sending and receiving   |   Closing a channel