Let's say I have an array that looks like this:
a = [cat, dog, cat, mouse, rat, dog, cat]
How do I get through this and do something with duplicates - for example. delete them?
In other words, if I did a.each do |i|
, then how I evaluate [0], against [1], a [2], a [3] ... and then when I find the one that I want, let's say [2] in this case has the first duplicate, then I push it onto the stack or delete it or something like that.
I know how to evaluate keys as well as values ββ... but how can I evaluate values ββagainst each other in the same array?
Thanks.
source share