Skip to content

Instantly share code, notes, and snippets.

@wildjcrt
Last active December 29, 2015 19:48
Show Gist options
  • Save wildjcrt/7719273 to your computer and use it in GitHub Desktop.
Save wildjcrt/7719273 to your computer and use it in GitHub Desktop.
hash = {
:carol => 'cancer',
:jaince => 'taurus',
:ting => 'twines',
:jerry => 'cancer'
}
ratings = Hash.new(0)
hash.values.each {|rate| ratings[rate] += 1}
# L9 equals to below.
ratings['cancer'] += 1
ratings['taurus'] += 1
ratings['twines'] += 1
ratings['cancer'] += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment