block (Basics) block
Documentation for block (Basics) block
assembled from the following types:
language documentation Raku by example P6-101
(Raku by example P6-101) block (Basics) block
You have seen blocks before: both the for
loop -> $line { ... }
and the if
statement worked on blocks. A block is a self-contained piece of Raku code with an optional signature (the -> $line
part).
The simplest way to sort the players by score would be @names.sort({ %matches{$_} })
, which sorts by number of matches won. However Ana and Dave have both won two matches. That simple sort doesn't account for the number of sets won, which is the secondary criterion to decide who has won the tournament.