title: Why Ruby .map doesn't work with if statement
body: <p>I'm getting an unexpected result with using <code>if</code> inside <code>.map</code>:</p>
  
  <pre><code>a = [1,2,3,4,5]
  a.map do |item|
    item + 10 if item &lt; 4
    item + 9  if item &gt; 4
  end
  </code></pre>
  
  <p>I expected: <code>[11,12,13,13,14]</code><br>
  ...but I'm instead getting: <code>[nil, nil, nil, nil, 14]</code>  </p>
  
  <p>Why's that?</p>
  
  <p>Secondly, I know that the last expression is the return value of method
  So does this true with if statement? The last expression is the return value of if statement.</p>
  
  <p>Thanks!</p>