RosettaCodeData/Task/Nth/Raku/nth-1.raku
2023-07-01 13:44:08 -04:00

5 lines
190 B
Raku

my %irregulars = <1 st 2 nd 3 rd>, (11..13 X=> 'th');
sub nth ($n) { $n ~ ( %irregulars{$n % 100} // %irregulars{$n % 10} // 'th' ) }
say .list».&nth for [^26], [250..265], [1000..1025];