title: Run a function in scala with a list as input
body: <p>I'M very nooby with Scala, so what I'm trying to do is execute a function that gets as a parameter a list created previously. Then I go thru the whole list reading every element in lower case to find a keyword.</p>
  
  <p>Finally, I count how many times is the word and return the value.My project is created as a Scala class, by the way in my code seems like the lower case it's not working to read every list element in the lower case. </p>
  
  <p>If I move all my code outside of a function that works but I don't understand why in a functional approach it doesn't go thru.</p>
  
  <p>Please guys, give me a hand to figure it out, thanks
  AU</p>
  
  <p>code:</p>
  
  <pre><code>object practiqueI extends App{
  //exercise 1
  /*  val liste = List(15,39,22,98,37,19,5)
    var z : Int = 0
  
    for (i &lt;- liste){
  
      z = z + i
    }
  
    println("the total is:",z)*/
  
  //exercise 2
    val list_txt = List("Introduction à la programmation ",
      "Practique de la programmation",
      "Structure de données",
      "principe de la programmation",
      "Algorithme","Langages de programmation")
  
  
    def wordrepeted(some: _*) : Int =  {
      var  counter_word:Int = 0
      var counter_nword: Int =0
      val word_cle: String = "programmation"
      var exist_word: Boolean = false
  
      for (i &lt;- some) {
        var test: String = i.toLowerCase
        if (test.contains(word_cle)) {
          counter_word +=  1
          exist_word = true
         } else {
           counter_nword += 1
        }
      }
      return counter_nword
    }
  
    wordrepeted(list_txt)
  
  }
  </code></pre>