January 2023
Beginner to intermediate
520 pages
16h 22m
English
We use only a basic subset of Scala in the book. Here is the chronological summary of all the Scala features we use in the book. You can look at them in your editor by going to the chA_ScalaCheatSheet.scala file in the book’s code repository. Make sure to look at the README.md file, too.
Defining a value
val x: Int = 2022 ① val y: String = "YYY" ① val z = true ①
① You can define the expected type of your value using :, but you don’t have to do it, and the compiler will try to infer it for you. Here, the inferred type of z is Boolean.
Defining a function
def f(a: Int): Int = {
a + 1 ①
}
def g(a: Int, b: String): Boolean = {
a == b.length && z ②
}
① Semicolons are not required, nor is the return keyword.
② Values are ...
Read now
Unlock full access