- Scala is compatible with Java. Java libraries and frameworks can be used without glue code or additional declarations.
- Definitions start with a reserved word.
- Function definitions start with
def
- variable definitions start with
var
- values (i.e. read only variables) start with
val
.
- Function definitions start with
- The declared type of a symbol is given after the symbol and a colon.
- The declared type can often be omitted
- Array types are written
Array[T]
rather thanT[]
,and array selections are writtena(i)
rather thana[i]
. Functions can be nested inside other functions.
- Nested functions can access parameters and local variables of enclosing functions.
it is possible to write programs in a conventional imperative or object-oriented style. However, it is also possible to write programs in a style which looks completely different.