Pattern extraction requires a case
, val
or var
prefix or must occur within a for
expression. Therefore, re-assigning the variables is not possible.
The Scala Language lists these cases in §§4.1 (values), 4.2 (variables), 6.19 (for-comprehensions) and 8.4 (pattern matching expressions)