title: Ruby: How to either set a variable to 0 or, if it is already set, increment by 1
body: <p>I know of the ||= operator, but don't think it'll help me here...trying to create an array that counts the number of "types" among an array of objects.</p>
  
  <pre><code>array.each do |c|
    newarray[c.type] = newarray[c.type] ? newarray[c.type]+1 ? 0
  end
  </code></pre>
  
  <p>Is there a more graceful way to do this?</p>