Mega Code Archive

 
Categories / Ruby / Array
 

Call uniq to remove the duplications

shopping_list = %w[ cheese bread crackers potatoes carrots cheese ] shopping_list.uniq! # => ["cheese", "bread", "crackers", "potatoes", "carrots"]