February 15, 2010
Esto es amor 2

rubyquicktips:

Get all the elements that two arrays have in common with the ampersand operator (&).

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

This is taken from the ‘Programming Ruby’ Book, where you can find out more.

  1. porta reblogged this from rubyquicktips
  2. rubyquicktips posted this
blog comments powered by Disqus