Inspired by the second VBScript version. x = ask("First number: ").to_i y = ask("Second number: ").to_i #Division uses floating point #Remainder uses sign of right hand side [:+ :- :* :/ :% :^].each { op | p "#{x} #{op} #{y} = #{x.call_method op, y}"