require 'byebug'as = 1..9 as.each do |a| (1..a).each do |b| a = a.to_i b = b.to_i #byebug # s 用作对齐 s = a*b >= 10 ? " " : " " print " #{b} * #{a} = #{a*b}#{s}" end puts " \n"end
require 'byebug'as = 1..9 as.each do |a| (1..a).each do |b| a = a.to_i b = b.to_i #byebug # s 用作对齐 s = a*b >= 10 ? " " : " " print " #{b} * #{a} = #{a*b}#{s}" end puts " \n"end