title: Ruby best practice : if not empty each do else in one operator
body: <p>1.I can't find an elegant way to write this code:</p>
  
  <pre><code>if array.empty?
    # process empty array
  else
    array.each do |el|
      # process el
    end
  end
  </code></pre>
  
  <p>I'd like to have one loop, without writing <code>array</code> twice. I read <a href="https://groups.google.com/forum/?fromgroups#!topic/columbusrb/tzX2iAtr-_A">this</a>, but there is no solution good enough.</p>
  
  <hr>
  
  <p>2.
  I am actually in an HAML template. Same question.</p>
  
  <pre><code>- if array.empty?
    %p No result
  - else
    %ul
    - array.each do |el|
      %li el
  </code></pre>