compiler errors - Scala declare multiple variables at the same row with the first character as upper-case -
i'm trying declare variables through tuple-assignment, such as:
val (hi, bye) = ("hi", "bye")
and fine. when having first character upper-case, compiler explodes , complains these variables not being defined.
val (hi, bye) = ("hi", "bye")
why doesn't work? i'm running scala 2.11.
by way works (as expected):
val hi = "hi" val bye = "bye"
from here:
the tuple on left-hand side pattern; names starting capital letters treated constants when occurring inside pattern. these constants must exist values in context. find exact semantics in scala spec under pattern matching.
Comments
Post a Comment