0
class UnitCircle
def prompt
puts "Enter a number: "
@number = gets
@number = @number.to_i
puts "Enter a trigonometric equation to perform on that number: "
@eqn = gets
end
end
uc = UnitCircle.new
uc.prompt
num = Math.send(uc.instance_eval {@eqn}, uc.instance_eval {@number})
當我嘗試用說運行它,爲什麼我得到一個NoMethodError?
@number = 30
@eqn = sin
我得到一個無方法的錯誤,爲什麼呢?