ruby-uebungen/Assignment_024/solution/readme.md

20 lines
236 B
Markdown
Raw Normal View History

2023-05-25 17:47:19 +02:00
# Lösung: Map
2023-05-23 09:19:31 +02:00
2023-05-25 17:49:42 +02:00
2023-05-25 17:47:19 +02:00
```ruby
def leeter(array)
array.map do |e|
e.gsub(/[aeiot]/, { \
'a' => '4', \
'e' => '3', \
'i' => '1', \
'o' => '0', \
't' => '7'})
2023-05-23 09:19:31 +02:00
end
end
2023-05-25 17:47:19 +02:00
test = %w{ Hello world }
puts leeter(test)
```