The Scala List class filter method implicitly loops over the List/Seq you supply, tests each element of the List with the function you supply. Your function must return true or false, and filter returns the list elements where your function returns t