In Syntax§
See primary documentation in context for term term:<>
You can use term:<>
to introduce new terms, which is handy for introducing constants that defy the rules of normal identifiers:
use Test; plan 1; constant &term:<👍> = &ok.assuming(True); 👍 # OUTPUT: «1..1ok 1 - »
But terms don't have to be constant: you can also use them for functions that don't take any arguments, and force the parser to expect an operator after them. For instance:
sub term:<dice> { (1..6).pick }; say dice + dice;
can print any number between 2 and 12.
If instead we had declared dice
as a regular
sub dice() {(1...6).pick }
, the expression dice + dice
would be parsed as dice(+(dice()))
, resulting in an error since sub dice
expects zero arguments.