Class Square def initialize(side_length) @side_length = side_length end
def area @side_length * @side_length end end
a = Square.new(10) puts a.area
显示 D:/2013/RUBY/class/2.rb:10: syntax error, unexpected kEND, expecting $end [Finished]
什么原因呢?
class 小写。。。。找到了,哈哈