I don't understand this method
<p>I'm a beginner in Ruby and I don't understand what this code is doing, could you explain it to me, please? </p>

<pre><code>def a(n)
  s = 0
  for i in 0..n-1
    s += i
  end
  s
end
</code></pre>