title: Assign variable only if not nil
body: <p>I have <code>@obj.items_per_page</code>, which is <code>20</code> at the beginning, and I want the method below to assign value to it only if <code>many_items</code> is not <code>nil</code>:</p>
  
  <pre><code>def fetch_it_baby (many_items = nil)
      @obj.items_per_page = many_items
  </code></pre>
  
  <p>With the code above, even if <code>many_items</code> is <code>nil</code>, <code>@obj.items_per_page</code> remains at <code>20</code>. Why? And is that "good" coding? Shouldn't I use something like</p>
  
  <pre><code>@obj.items_per_page = many_items || @obj.items_per_page
  </code></pre>
  
  <p>Or is there a third way? I don't feel completely comfortable with either way.</p>