Array in Ruby | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Array in Ruby

in subtracting arrays in Ruby, do we eliminate similar ones?

8th Apr 2018, 4:23 AM
JR. BARBOSA🇧🇷
JR. BARBOSA🇧🇷 - avatar
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
8th Apr 2018, 4:40 AM
Lord Krishna
Lord Krishna - avatar
+ 2
thanks
8th Apr 2018, 4:42 AM
JR. BARBOSA🇧🇷
JR. BARBOSA🇧🇷 - avatar