title: Default arguments in ruby
body: <p>I am trying to set up default parameter and I would like to skip passing an argument and assign particular arguments in the function call. But, I am not able to get the desired output.</p>
  
  <pre><code>require "json"
  def stun(voltage = 0,frequency = 0,range = "",scope = "")
      body = {
          :voltage =&gt; voltage,
          :frequency =&gt; frequency,
          :range =&gt; range,
          :scope =&gt; scope
      }
      response = body.to_json
  end
  
  
  stun(voltage = 1,frequency = 2,scope = "universal")
  </code></pre>
  
  <p>As you can see in the code above, I am trying to assign value to scope while keeping the range parameter an empty string. I am getting the following response.</p>
  
  <pre><code>"{\"voltage\":1,\"frequency\":2,\"range\":\"universal\",\"scope\":\"\"}"
  </code></pre>
  
  <p>My desired output would be to have range as an empty string and scope as "universal"</p>