11. Scala Environment Setup
• Scala runs on the JVM. So for Scala Environment Setup, you’ll need to
have Java installed on your machine.
• Now, we’ll need to Install Scala.
• Official site: https://www.scala-lang.org/download/
• Once you hit download, you’ll see the following:
18. Step 7:
• We’re done; click ‘Finish’.
• Now, when you get in the command prompt, type scala:
• C:Userslifei>scala
• Welcome to Scala 2.12.5 (Java HotSpot(TM) 64-Bit Server VM, Java
1.8.0_151).
• Type in expressions for evaluation.
20. Mutable Variable
• Mutable variables are defined by using the var keyword.
• It allows you to change value after declaration of variable.
Eg:
var data = 100 var data:Int = 100
data = 101
21. Immutable Variable
• These variables do not allow you to change a value after the declaration of a
variable.
• Immutable variables are defined by using the val keyword.
• Eg:
var data = 100 Output: Error: reassignment to val
data = 101