ruby-uebungen/Assignment_023/solution/readme.md

15 lines
500 B
Markdown
Raw Normal View History

2023-05-25 17:47:19 +02:00
# Lösung: Hashes
2023-05-23 09:19:31 +02:00
2023-05-25 17:47:19 +02:00
<div style="border: 1px solid grey;"><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div>
```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
```