错误信息是:
undefined method 'rectangle' for main:object(NoMethod Error)
这个是ruby的错误提示,不知道是意思,请大神帮忙解决
代码如下:
class Rectangle
def initialize(wdth,hgt)
@width = wdth
@height = hgt
end
def width=(wdth)
@width = wdth
end
end
r = Rectangle(2,3)
puts r.width = 5
puts r.width