Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Array#concat

array.concat(*other_arrays) → self

Adds to array all elements from each Array in other_arrays; returns self:

Example
a = [0, 1]
a.concat([2, 3], [4, 5]) # => [0, 1, 2, 3, 4, 5]
See also #compact! #count #compact #cycle also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1