init selects all the elements in a Traversable collection but the last one. It can be defined formally as follows:
def init: Traversable[A]
Let's see an example as follows:
scala> List(1,2,3,4) init
res7: List[Int] = List(1, 2, 3)
In Scala, if you want to select all elements except the first n elements, you should use drop. In the next subsection, we will see how to use drop.