Mega Code Archive

 
Categories / Ruby / Array
 

Union () joins two arrays together, removing duplicates

tue = [ "shop", "eat", "sleep" ] wed = [ "shop", "eat", "read", "sleep" ] tue | wed # => ["shop", "eat", "read", "sleep"]