πŸ“˜ The list method in Perl 6 channels

πŸ“˜ The list method in Raku channels

N. B. Perl 6 has been renamed to Raku. Click to read more.


The list method accompanies the previously seen methods and returns everything that is left unread in the channel.

my $c = Channel.new;Β 

$c.send(5);
$c.send(6);Β 

$c.close;
say $c.list; # (5 6)

The method blocks the programme until the channel is open, thus it is wise to close it before calling the list method.

Leave a Reply

Your email address will not be published. Required fields are marked *

Retype the CAPTCHA code from the image
Change the CAPTCHA codeSpeak the CAPTCHA code