Skip to content

Instantly share code, notes, and snippets.

@amitpatelx
Created May 21, 2012 18:28
Show Gist options
  • Save amitpatelx/2763786 to your computer and use it in GitHub Desktop.
Save amitpatelx/2763786 to your computer and use it in GitHub Desktop.
Remove element of an array conditionally
1.9.3-p125 :002 > [1,2,3,4,5].delete_if{|i| i%2==0}
=> [1, 3, 5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment