Multiplication tables: Difference between revisions
Content added Content deleted
(→{{header|APL}}: Removed faulty APL solution) |
m (→{{header|Sidef}}: updated code) |
||
Line 3,928: | Line 3,928: | ||
=={{header|Sidef}}== |
=={{header|Sidef}}== |
||
<lang ruby>var max = 12 |
<lang ruby>var max = 12 |
||
var width = (max**2 -> len+1) |
var width = (max**2 -> len+1) |
||
func fmt_row(*items) { |
func fmt_row(*items) { |
||
items.map { |
items.map {|s| "%*s" % (width, s) }.join |
||
} |
} |
||
⚫ | |||
say "#{'━' * (width - 1)}╋#{'━' * (max * width)}" |
|||
{ |i| |
|||
⚫ | |||
say "#{ |
say fmt_row("#{i}┃", {|j| i <= j ? i*j : ''}.map(1..max)...) |
||
⚫ | |||
max.times { |i| |
|||
say fmt_row("#{i}┃", (1..max).map {|j| i <= j ? i*j : ''}...); |
|||
⚫ | |||
{{out}} |
{{out}} |
||
<pre> |
<pre> |