method
+
+(p1)
public
Concatenation—Returns a new array built by concatenating the two arrays together to produce a third array.
[ 1, 2, 3 ] + [ 4, 5 ] #=> [ 1, 2, 3, 4, 5 ]
Register or
log in
to add new notes.
joshuapinter -
January 4, 2012
0 thanks
Total Unique Elements from Two Arrays
Simple but thought it was worth mentioning:
( [ 1, 2, 3 ] + [ 3, 4, 5 ] ).uniq #=> [ 1, 2, 3, 4, 5 ]
mindloaf -
January 11, 2012
0 thanks
Total Unique Elements: Set Union
For total unique elements, see set union: http://apidock.com/ruby/Array/|