Each, Collect, Map, Select, Find, Find_all….Oh My!

animals = ["owl", "dog", "bear", "rabbit"]def capitalize_names(animals)   animals.each do |animal|      puts animal.capitalize   endend
def capitalize_names(animals)   cap = animals.map do |animal|      animal.capitalize   end      print cap      return capend
def word_letters(animals)   cap = animals.select do |animal|      animal.length > 3   end      print cap      return capend
def word_letters(animals)   cap = animals.find do |animal|      animal.length > 3   end      print cap      return capend
def word_letters(animals)   cap = animals.find_all do |animal|      animal.length > 3   end      print cap      return capend

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store