method
concat
v1_8_7_72 -
Show latest stable
- Class:
Array
concat(p1)public
Appends the elements in other_array to self.
[ "a", "b" ].concat( ["c", "d"] ) #=> [ "a", "b", "c", "d" ]
1Note
Changes self
This method changes the object/array the method is called on. For example:
a = ["a", "b", "c"]
b = ["x", "y", "z"]
a.concat(b) #=> [a", "b", "c", "z", "y", "z"]
a #=> [a", "b", "c", "z", "y", "z"]
In this example the object A is modified, the method modifies the object, then returns the new object.