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.
Ruby でこの配列を作成する最短の方法は次のとおりです。
[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
助けてくれてありがとう!
これにより、コンストラクターから直接配列が構築されます。
Array.new(10){|i| (i + 1) * 10} # => [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]