title: Find the sum of cubes in Scala
body: <p>I want to code a function in Scala that takes two integers and sums the cube of every value in the inclusive range of those two integers.</p>
  
  <p>For example, I call:</p>
  
  <pre><code>sumCubes(0,2)
  </code></pre>
  
  <p>I must get the result <strong>9</strong> because (0^3+1^3+2^3) = 9.</p>
  
  <p>I have to use the <code>range</code> method and consider this template:</p>
  
  <pre><code>def sumCubes2(x: Int, y: Int)= {
  @annotation.tailrec
  def fAux(acc: Int,xs: List[Int]): Int= ???
  ???
  }
  </code></pre>
  
  <p>I thought about creating a list with the elements in the range of the two integers and another variable that will contain the final result:</p>
  
  <pre><code>var rangeList = List.range(x, y)
  var finalValue = 0
  </code></pre>
  
  <p>Now I don't know if I should use a for loop or call recursively the function fAux somehow.</p>