乐趣区

关于ruby:Ruby-实现-九九乘法表

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

退出移动版