best way to select uncommon elements from array

I have two arrays and i want to get all items which are NOT common to both, so basically if i have two arrays A and B, i want all elements in A that are not in B. what is the best way to do this apart from using two nested loops.

thanks rahtha

A - B ?

But do you want the ones in B that are not in A as well? (symmetric difference)

Nope don't care about that case just the ones in A that are not in B

rahtha wrote:

Nope don't care about that case just the ones in A that are not in B

Well, then it's what Frederick said.

irb(main):065:0> a = [1,2,3] => [1, 2, 3] irb(main):066:0> b = [2,4,6] => [2, 4, 6] irb(main):067:0> a-b => [1, 3]