我有一个add_and_power.rb
如下命名的文件,并想在 Sublime Text 上运行它。
def add_and_power a,b
(a+b)**(a+b)
end
puts "First number please? "
input1 = gets
puts "Second number please? "
input2 = gets
puts "The result is: ", add_and_power(input1.to_i, input2.to_i)
我跑了cmd+b
,但它只是显示,
First number please?
Second number please?
The result is:
1
[Finished in 0.9s]
我想输入2
并3
得到答案。如何让 Sublime Text 2 要求输入并返回答案?