Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想生成1.1, 2.2, 3.3, ... 但我能想出的唯一方法是:
1.1
2.2
3.3
100.times do |i| ary << "#{i}.#{i}".to_f end
有没有更优雅或更有效的方法来做到这一点?
做事总是有不同的方式,但我认为你所拥有的一切都很好。