+ 1
Array in Ruby
in subtracting arrays in Ruby, do we eliminate similar ones?
2 Answers
+ 3
Subtracting two arrays which have similar elements returns the 1st array with the elements from 2nd array removed
a1 = [1, 2, 3, 4, 5]
a2 = [1, 2, 3]
p a1 - a2
-> [4, 5]
http://www.techotopia.com/index.php/Advanced_Ruby_Arrays
https://stackoverflow.com/questions/1192186/subtracting-one-array-from-another-in-ruby
+ 2
thanks