After reading this answer, I tried to play with this pleasant opportunity myself and found out that this is normal when I 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 this is not normal with a 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 for this behavior?
UPD Actually, the same thing with binding tuples:
scala> val (a,b,N) = (1,2,3) <console>:9: error: not found: value N val (a,b,N) = (1,2,3)
om-nom-nom
source share