Every Scala coder should remember the difference between Constant and Variable patterns in
pattern matching. Short refresh from this topic: if pattern starts from low case letter: it is counted as a variable. We can still use a lowercase name for a pattern constant, using one of two tricks:
1). If the constant is a field of any object, we can prefix it with a qualifier. For example, name is a variable pattern, but this.name or objInstance.name.
pattern matching. Short refresh from this topic: if pattern starts from low case letter: it is counted as a variable. We can still use a lowercase name for a pattern constant, using one of two tricks:
1). If the constant is a field of any object, we can prefix it with a qualifier. For example, name is a variable pattern, but this.name or objInstance.name.
2) Second workaround is enclosing the variable name with back ticks. For instance, `name` would again be interpreted as a constant, not as a variable.