Scala has two types of variables
- Var - creates an Immutable variable(i.e final in java)
- Val – creates a mutable variable(i.e you can reassign a value)
The distinction among val and var is that val makes a variable permanent, like final in Java — and var makes a variable alterable. Since val fields can't change but var value can be reassigned .