The basics
The previous part put a program on the machine. This part is the language itself: the two ways to name a value, the types a value can have, numbers and strings, the operators that turn out to be methods, the expression that every block is, the loops, the methods and the way a file declares its package. Nothing here needs an object yet, and every program of the part is a whole file that was compiled and run.
2.1
Values and types
val and var, inference, a declared type, Unit and Nothing
Open
2.2
Numbers
Int, Long and Double, integer division, overflow, BigInt and BigDecimal
Open
2.3
Strings and interpolation
s, f and raw strings, triple quotes, stripMargin, and the string methods
Open
2.4
Operators are methods
why 1 + 2 is a call, how precedence follows the first character, and a custom operator
Open
2.5
Expressions and if
every block has a value, if with then and else, and why there is no ternary
Open
2.6
Loops and for comprehensions
for with yield, guards, nested generators, while, and the boundary that breaks out
Open
2.7
Methods and parameters
def, the result type, default and named arguments, varargs, and recursion
Open
2.8
Blocks, indentation, packages and imports
significant indentation, end markers, package clauses, and the import forms
Open