0038 Array_concatenation

Merge arrays

The Array class defines the + and - methods. But also | and & for union and intersection.

0038-array_concatenation_1.png

No surprises with the + method, which concatenates arrays, and -, which subtracts. | and & will also remove duplicated elements. Order of arrays are preserved.

0038-array_concatenation_2.png

The ^ method has not been implemented. But if necessary, you can make the symmetrical difference by hand!

0038-array_concatenation_3.png

Links to Ruby documentation for Array#+, Array#-, Array#| and Array#&.