【发布时间】:2012-06-04 16:00:51
【问题描述】:
在 ruby 1.8.7 的集合上使用 each_with_index 时,如何指定从哪个索引开始?
collection.each_with_index do |element, index = 1|
#do smth
end
这样使用会出现以下错误:
syntax error, unexpected '=', expecting '|'
collection.each_with_index do |element, i = 1|
【问题讨论】:
标签: ruby-on-rails ruby ruby-enterprise-edition