From the course: Scala Essential Training for Data Science

Unlock this course with a free trial

Join today to access over 24,700 courses taught by industry experts.

Solution: Create variables

Solution: Create variables

- [Instructor] Okay, to create an explicit integer, we have, in this case, Val explicit int, and then we specify equals and 100. For the char, we will specify the data type of char, and we will set that to an initial value of, let's say A. Now for the implicit long, we will simply have an equal sign and then a long value, like one with several zeros after it and an L. And then for the float, we'll specify, how about 3.14, and we'll use the letter F after that. And then let's test our code. And we have our output and the code returned true. So that is how we can define variables.

Contents