class Fixnum
def repeat
for i in 1..self.to_i
yield
end
end
end
z = Fixnum.new 4
上面的程序是给undefined method new for Fixnum:Class (NoMethodError)
. 为什么这样?我刚刚尝试在另一个课程中使用它并且它有效。
谢谢!
class Fixnum
def repeat
for i in 1..self.to_i
yield
end
end
end
z = Fixnum.new 4
上面的程序是给undefined method new for Fixnum:Class (NoMethodError)
. 为什么这样?我刚刚尝试在另一个课程中使用它并且它有效。
谢谢!