Mega Code Archive

 
Categories / Ruby / Array
 

Difference (-) creates a new array, removing elements that appear in both arrays

tue = [ "shop", "eat", "sleep" ] wed = [ "shop", "eat", "read", "sleep" ] wed - tue # => ["read"]