Skip to content

Instantly share code, notes, and snippets.

@spyderman4g63
Created November 28, 2012 21:19
Show Gist options
  • Save spyderman4g63/4164616 to your computer and use it in GitHub Desktop.
Save spyderman4g63/4164616 to your computer and use it in GitHub Desktop.
Get array differences
require 'set'
#create array
a = [1,2,3,4]
b = [2,3,5,6]
#convert to set
a.to_set
b.to_set
#remove items in b from a
diff = (a - b)
#output what ever is left
puts diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment