From: Jean-Julien Fleck on
Hello Derek,

2010/4/12 Derek Cannon <novellterminator(a)gmail.com>:
> Thanks Jean, this is the first thing I tried, but I accidentally used
> the word "and" instead of &.
>
> What's the difference between & and "and" in this case?

Well, they have quite nothing in common here :o)
On one hand, you are thinking of && which is (almost) the same as
'and' (except concerning precedence).
On the other end, '&' is here the intersection operator defined in the
array class:

Chandler ~>ri 'Array.&'
---------------------------------------------------------------- Array#&
array & other_array

From Ruby 1.8
------------------------------------------------------------------------
Set Intersection---Returns a new array containing elements common
to the two arrays, with no duplicates.

[ 1, 1, 3, 5 ] & [ 1, 2, 3 ] #=> [ 1, 3 ]


Cheers,

--
JJ Fleck
PCSI1 Lycée Kléber