Skip to content

Instantly share code, notes, and snippets.

@benaskins
Created October 30, 2012 02:43
Show Gist options
  • Save benaskins/3978004 to your computer and use it in GitHub Desktop.
Save benaskins/3978004 to your computer and use it in GitHub Desktop.
1.9.3p125 :001 > [1,2,3,4,5,6,7,8].map { |n| n if n %2 == 0 }
=> [nil, 2, nil, 4, nil, 6, nil, 8]
1.9.3p125 :002 > [1,2,3,4,5,6,7,8].select { |n| n %2 == 0 }
=> [2, 4, 6, 8]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment