还是一个练习,if next_move.is_a?(Numeric)== true 这个我输入任意数字,他都跳转到了 dead 去,是哪里写错了吗?
def gold_room()
puts "This room is full of gold. How much do you take?"
prompt
next_move = gets.chomp
if next_move.is_a?(Numeric)== true
how_much=next_move.to_i()
else
dead("Man,learn to type a number.")
end
if how_much<50
puts "Nice,you're not greedy,you win!"
Process.exit(0)
else
dear("You greedy bastard!")
end
end