More concise Rubyish code.

Hash key checking is not necessary in this case.  If a key doesn't exist in a Hash, Ruby returns nil by default and nil is falsy. Hash key checking would only be necessary if the Hash had been set up with a default value.
This commit is contained in:
Timo J
2019-12-08 12:03:15 +01:00
committed by GitHub
parent d8da439590
commit c849e75041

View File

@@ -3,7 +3,7 @@
@voted = {}
def check_voter(name)
if @voted.key?(name) && @voted[name]
if @voted[name]
puts "kick them out!"
else
@voted[name] = true