Course of Raku / Advanced / Subroutines / The Whatever star 🆕 / Exercises / A two-argument Whatever
Solution: A two-argument Whatever
Here is a possible solution to the task.
Code
my $join = * ~ '-' ~ *;
say $join('a', 'b');🦋 You can find the source code in the file two-arg-whatever.raku.
Output
a-bComments
The expression contains two stars, so Raku builds a
WhateverCodethat takes two arguments — the first star is the first argument, the second star is the second.Calling
$join('a', 'b')fills the stars in order, giving'a' ~ '-' ~ 'b', which isa-b.