【发布时间】:2010-02-22 08:25:13
【问题描述】:
我怎样才能使下面的代码工作,使puts 都显示1?
video = []
name = "video"
name[0] = 1
puts name[0] #gives me 1
puts video[0] #gives me nil
【问题讨论】:
-
如果你真的需要,使用
eval()。查看stackoverflow.com/questions/2168666/…的答案