Scala Data Types
The presumes you have Scala installed on the local system.
This is just the basics on declaring variables in Scala and what data types are available.
src/main/scala/Playground.scala with the following.
printlnwill allow us to print to the console.
Appallows us to run the file in the command line correctly.
valare immutable - this is the Scala and functional programming way.
Say we remove the explicit type:
This still works as the compiler infers the type to be an
Declaring various types
Below we will run through a declaration of each type.
Note that the
var keywords have different meanings.
val is a constant and follows functional, immutable conventions while
var is mutable and changing a mutable variable is known as a side effect.
1,200+ PEOPLE ALREADY JOINED ❤️️
Get fresh posts + news direct to your inbox.
No spam. We only send you relevant content.