ruby-uebungen/Assignment_025/solution/readme.md

15 lines
500 B
Markdown

# Lösung: Hashes
<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
end
puts de_dupe(worte)
```