Course of Raku / Advanced / Subroutines / The Whatever star 🆕 / Exercises

A two-argument Whatever

Problem

Each * in a Whatever expression is a separate argument, so an expression with two stars builds a two-argument function. Write one that joins its two arguments with a hyphen between them — * ~ '-' ~ * — store it in a variable, then call it with 'a' and 'b' and print the result.

Example

The program prints:

a-b

Solution

See the solution

Course navigation

Solution: Whatever with map   |   Solution: A two-argument Whatever