how to get the nth element in a list in scala code example
Example 1: how to get the nth element in a list in scala
val x = List(1,2,3,4,5)
println(x(3)) // output: 4
Example 2: scala get the first element of a seq
Seq("1", "two", "3").head
val x = List(1,2,3,4,5)
println(x(3)) // output: 4
Seq("1", "two", "3").head