Ruby Method of the Day - Array.-
Signature
array - other_array #=> new_array
array - other_array returns new_array that contains the
difference of the
two arrays. In other words, new_array contains the elements that are in
array but not in other_array
Examples
1 2 3 |
a = [1,2,3,4,5,6,7,8,8,9,10] #=> [1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10] a - [1, 8] #=> [2, 3, 4, 5, 6, 7, 9, 10] a - [-1, 22, 4, 9] #=> [1, 2, 3, 5, 6, 7, 8, 8, 10] |
Documentation Reference
Ruby version 1.8.6
