title: Why is this while loop giving me an error scala
body: <p>Trying to take a list of strings and add them all together to form one string in scala recursively. I don't know why, but my IDE keeps giving me a redline under the while part of my while loop and it says type mismatch, String required. But I've tested it and having the system evaluate (List()==Nil) is valid so whats wrong with the loop?</p>
  
  <pre><code>  def concatAlL (l: List[String]) : String =  {
    while (l!=Nil){
       return l.head++concatAlL(l.tail)
    }
    return ""
  }
  </code></pre>