Type Casting in Scala
In the following lesson, you will be introduced to type casting and learn how to change the data type of a variable.
Introduction
Sometimes we find ourselves in a situation where we need the value of an already existing variable in a different data type than the one with which it was defined. This is where type casting comes in. Type casting is an approach which allows changing the data type of a variable or an expression from one to another.
One thing to remember is that not every data type can be converted to a data type of choice. Let’s look ...