On Oct 11, 11:50=A0pm, Tj Superfly <nonstickg... / verizon.net> wrote:
> Hey, I just have a quick question about arrays.
>
> I have two different ones that I would like to compare.
>
> Example:
>
> Array 1: cats, dogs, monkeys
>
> Array 2: cats, fish, dogs, birds, monkeys
>
> Now, I would like to compare array 2 with array 1 and have it spit out
> any words that aren't in both... if that makes sense.
>
> So what the program should output is fish, monkeys.
> --
> Posted viahttp://www.ruby-forum.com/.

Im assuming the elements in the array are strings so.....

so we have arr1 and arr2 with the previous mentioned elements i guess
you could make a method something like this and then depending on how
your comparing these elements...

def print_elements_not_in_array
  arr1.each do |temp|
    arr2.each do |temp2|
      puts " #{temp2} " if temp1 !=3D temp2
    end
  end
end