Permalink
Browse files

Tentativa com Symbols em ruby

  • Loading branch information...
1 parent a2db4f6 commit f0c11fdb625729f0b78cf857d87126075cdb8855 @philss committed Jan 14, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 eleicoes/eleicoes.rb
View
@@ -7,14 +7,14 @@
size.times do
vote = gets.to_i
if vote > 0 and vote <= 1000000000
- if count[vote] == nil
- count[vote] = 1
+ if count[vote.to_s.to_sym]
+ count[vote.to_s.to_sym] += 1
else
- count[vote] += 1
+ count[vote.to_s.to_sym] = 1
end
- if count[vote] > winner_points
+ if count[vote.to_s.to_sym] > winner_points
winner = vote
- winner_points = count[vote]
+ winner_points = count[vote.to_s.to_sym]
end
end
end

0 comments on commit f0c11fd

Please sign in to comment.