title: Understanding "Useless assignment to variable"
body: <p>I have a Ruby function that returns a single variable subsequently used by the caller however I get the following warning </p>
  
  <blockquote>
    <p>warning: assigned but unused variable</p>
  </blockquote>
  
  <p>I have put together a contrived example that will show this error with "ruby -cw" </p>
  
  <pre><code>def get_sum(num1, num2)
    sum = num1 + num2
  end
  puts get_sum(1, 1)
  </code></pre>
  
  <p>and if I check it with "ruby -cw" I get the above warning. However I am using the "sum" variable - just not in that function's scope. How can I avoid this warning? (and satisfy Rubocop too).</p>