标题: 脚本哪里错了 [打印本页] 作者: 萌小妖 时间: 2013-12-10 16:53 标题: 脚本哪里错了 class People
attr_accessor:name,:age,:motherland
end
class People
def talk
print "my name is#{@name},age is{@age},motherland is{@motherland}"
end
end
p=People.new
p.name="zhangshan"
p.age=17
p.motherland="china"
p.talk
为什么输出总是 my name is zhangshan,age is{@age},motherland is{@motherland}"作者: MustDante 时间: 2013-12-10 16:56
坐等删帖作者: RyanBern 时间: 2013-12-10 17:15
print "my name is #{@name},age is #{@age},motherland is #{@motherland}"