Task

Produce a formatted   12×12   multiplication table of the kind memorized by rote when in primary (or elementary) school.



Only print the top half triangle of products.




var max = 12
var width = (max**2 -> len+1)
 
func fmt_row(*items) {
    items.map {|s| "%*s" % (width, s) }.join
}
 
say fmt_row('x┃', (1..max)...)
say "#{'━' * (width - 1)}╋#{'━' * (max * width)}"
 
{ |i| 
    say fmt_row("#{i}┃", {|j| i <= j ? i*j : ''}.map(1..max)...)
} << 1..max