puts "first number please"
first = gets.chomp
puts "Second number please"
second = gets.chomp
answer = first + second
puts "The calculation is #{first} + #{second} = " + answer.to_s
我总结了两个变量first
和second
如果first
== 1 和second
== 2 那么answer
应该是 3,但是 ruby 显示 12 有什么问题?
我尝试的是
answer = first.+(second)