ruby-uebungen/Assignment_025/solution/readme.md

181 B

Lösung: Map und Reduce

def char_count(array)
  counts = array.map { |e| e.length }
  counts.reduce(:+)
end

array = %w{ Free Kevin Mitnick }
puts char_count(array)