小编Jes*_*sus的帖子

没有那个特定的行,我的代码不起作用.为什么?

puts "Enter the first number"
num1 = Float(gets)

puts "Enter the second number"
num2 = Float(gets)

puts "Enter the operation"
op = gets
op = op.chomp # <--- THIS LINE!

case op 
when "+" then puts num1 + num2
when "-" then puts num1 - num2    
when "*" then puts num1 * num2    
when "/" then puts num1 / num2
end
Run Code Online (Sandbox Code Playgroud)

ruby chomp

1
推荐指数
1
解决办法
50
查看次数

标签 统计

chomp ×1

ruby ×1