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.

008 Values and types val and var, inference, a declared type, Unit and Nothing Open 009 Numbers Int, Long and Double, integer division, overflow, BigInt and BigDecimal Open 010 Strings and interpolation s, f and raw strings, triple quotes, stripMargin, and the string methods Open 011 Operators are methods why 1 + 2 is a call, how precedence follows the first character, and a custom operator Open 012 Expressions and if every block has a value, if with then and else, and why there is no ternary Open 013 Loops and for comprehensions for with yield, guards, nested generators, while, and the boundary that breaks out Open 014 Methods and parameters def, the result type, default and named arguments, varargs, and recursion Open 015 Blocks, indentation, packages and imports significant indentation, end markers, package clauses, and the import forms Open

Lessons