Multiplication tables: Difference between revisions
Content added Content deleted
No edit summary |
SqrtNegInf (talk | contribs) m (→{{header|Raku}}: condense code layout) |
||
Line 6,058: | Line 6,058: | ||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
(formerly Perl 6) |
(formerly Perl 6) |
||
<lang perl6>(my $f = "%{$_}s" given my $width = ($_**2).chars ) given my $max = 12; |
|||
{{trans|Perl}} |
|||
⚫ | |||
{{works with|Rakudo Star|2010.08}} |
|||
⚫ | |||
<lang perl6>my $max = 12; |
|||
my $width = chars $max**2; |
|||
my $f = "%{$width}s"; |
|||
⚫ | |||
⚫ | |||
for 1..$max -> $i { |
for 1..$max -> $i { |
||
say $i.fmt($f) |
say $i.fmt($f) ~ ' ┃ ' ~ ( $i ≤ $_ ?? $i×$_ !! '' for 1..$max ).fmt($f); |
||
for 1..$max -> $j { |
|||
$i <= $j ?? $i*$j !! ''; |
|||
} |
|||
).fmt($f); |
|||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |