一段RUBY代码,既不报错,但是不输出结果,帮忙看下
class Song
def initialize(name,artist,duration)
@name = name
@artist = artist
@duration = duration
end
def to_s
"Song: #{@name}--#{@artist} (#{@duration})"
end
end
song = Song.new("zl","123",36);
song.inspect
song调用inspect不是得打印一些东西吗
[解决办法]
少了puts