Skip to content

Instantly share code, notes, and snippets.

@lexruee
Created March 19, 2020 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lexruee/43d7d618107af7d61f8ee42f4e2c9b32 to your computer and use it in GitHub Desktop.
Save lexruee/43d7d618107af7d61f8ee42f4e2c9b32 to your computer and use it in GitHub Desktop.
Compare two arrays and return a new array with any items only found in one of the two given arrays, but not both.
def diff_array(first_array, second_array)
(first_array - second_array) + (second_array - first_array)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment