title: Is it possible to define a block with default arguments in Ruby?
body: <p><a href="https://stackoverflow.com/questions/451689/is-it-possible-to-define-a-block-with-optional-arguments-in-ruby">This question</a> deals with optional arguments passed to a Ruby block. I'm wondering if it's also possible to define arguments with default values, and what the syntax for that would be.</p>
  
  <p>At first glance, it appears that the answer is "no":</p>
  
  <pre><code>def call_it &amp;block
    block.call
  end
  
  call_it do |x = "foo"|
    p "Called the block with value #{x}"
  end
  </code></pre>
  
  <p>...results in:</p>
  
  <pre><code>my_test.rb:5: syntax error, unexpected '=', expecting '|'
      call_it do |x = "foo"|
                     ^
  my_test.rb:6: syntax error, unexpected tSTRING_BEG, expecting kDO or '{' or '('
        p "Called the block with value #{x}"
           ^
  my_test.rb:7: syntax error, unexpected kEND, expecting $end
      end
         ^
  </code></pre>