title: Passing multiple code blocks as arguments in Ruby
body: <p>I have a method which takes a code block.</p>
  
  <pre><code>def opportunity
    @opportunities += 1
    if yield
      @performances +=1
    end
  end
  </code></pre>
  
  <p>and I call it like this:</p>
  
  <p><code>opportunity { @some_array.empty? }</code></p>
  
  <p>But how do I pass it more than one code block so that I could use yield twice, something like this:</p>
  
  <pre><code>def opportunity
    if yield_1
      @opportunities += 1
    end
    if yield_2
      @performances +=1
    end
  end
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>opportunity {@some_other_array.empty?} { @some_array.empty? }
  </code></pre>
  
  <p>I am aware that this example could be done without yield, but it's just to illustrate.</p>