我可以在each_with_index循环迭代器中定义索引的偏移量吗?我的直接尝试失败了:
some_array.each_with_index{|item, index = 1| some_func(item, index) }
编辑:
澄清:我不想要数组偏移我希望each_with_index中的索引不是从0开始,而是例如1.
ruby iteration
iteration ×1
ruby ×1