#Defined the array arr = [2, 3, 4, 5, 6, 5, 7, 7, 77, 96, 3] #Puts the original array and the duplicateless array puts "#{arr}" #=> [2, 3, 4, 5, 6, 5, 7, 7, 77, 96, 3] #Using the method uniq without a block checks if an item is overall the exact same as the other puts "\n#{arr.uniq}" #=> [2, 3, 4, 5, 6, 7, 77, 96] #redefines arr arr = ["3", "34242", "fsa5", "4444", "food"] #With a block it checks for duplicates that fit the condition or return the same value in a specific instance #puts arr, and arr.uniq with and without a block puts "\n#{arr}" #=> ["3", "34242", "fsa5", "4444", "food"] #here putting uniq doesn't do anything because all the items aren't entirely the same puts "\n#{arr.uniq}\n\n" #=> ["3", "34242", "fsa5", "4444", "food"] #here the block specifies what to look for, the item's length, so the last two items are removed puts arr.uniq {|x| x.length}.to_s #=> ["3", "34242", "fsa5"] #and finally to permanently change the array arr.uniq!