2023-05-25 17:47:19 +02:00
|
|
|
# Lösung: Hashes
|
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
|
|
|
|
worte = %w{ Bier Schnaps Bier Vodka Rum Baileys Rum Bier Vodka Bier Hugo }
|
|
|
|
|
|
|
|
def de_dupe(input)
|
|
|
|
hash = {}
|
|
|
|
input.each { |e| hash[e] = true }
|
|
|
|
hash.keys.sort
|
2023-05-23 09:19:31 +02:00
|
|
|
end
|
|
|
|
|
2023-05-25 17:47:19 +02:00
|
|
|
puts de_dupe(worte)
|
2023-05-23 09:19:31 +02:00
|
|
|
```
|