ruby-uebungen/Assignment_025/solution/readme.md

13 lines
181 B
Markdown

# Lösung: Map und Reduce
```ruby
def char_count(array)
counts = array.map { |e| e.length }
counts.reduce(:+)
end
array = %w{ Free Kevin Mitnick }
puts char_count(array)
```