#!/usr/bin/ruby

#
## https://rosettacode.org/wiki/Multiplication_tables
#

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)}";
 
for i in (1..max) {
    say fmt_row("#{i}┃", (1..max).map {|j| i <= j ? i*j : ''}...);
}