From: Jean-Julien Fleck Date: 2010-08-21T23:23:21+09:00 Subject: Re: A small problem for arrays 2010/8/21 Unc88 Unc88 : > I have 2 array. ar_1, ar_2 > How can we, on the basis of existing arrays to create an array ar_3, of > all the elements that are ar_1 and are not included in ar_2. Just make the difference between the two arrays: >> a1 = (1..10).to_a => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >> a2 = (4..7).to_a => [4, 5, 6, 7] >> a1 - a2 => [1, 2, 3, 8, 9, 10] >> a2 - a1 => [] Cheers, -- JJ Fleck PCSI1 Lycée Kléber