After reading this answer I’ve tried to play with this nice feature by myself and found out that it is ok when I’m do
scala> val Array(a,b,n) = "XXX,YYY,ZZZ".split(",")
a: java.lang.String = XXX
b: java.lang.String = YYY
n: java.lang.String = ZZZ
But is not ok with uppercase named variable:
scala> val Array(a,b,N) = "XXX,YYY,ZZZ".split(",")
<console>:9: error: not found: value N
val Array(a,b,N) = "XXX,YYY,ZZZ".split(",")
What is the reason of such behavior?
UPD
Actually, the same thing with tuples assigment:
scala> val (a,b,N) = (1,2,3)
<console>:9: error: not found: value N
val (a,b,N) = (1,2,3)
Scala treats it as a constant against which to match the pattern. Observe:
The variables in which you want to extract the values must begin with a lower-case letter.