Local Type Inference - Scala Documentation

Scala has a built-in type inference mechanism which allows the programmer to omit certain type annotations. It is, for instance, often not necessary in Scala to specify the type of a variable, since the compiler can deduce the type from the initialization expression of the variable. Also return types of methods can often be omitted since they correspond to the type of the body, which gets inferred by the compiler.


This is a companion discussion topic for the original entry at http://docs.scala-lang.org//tutorials/tour/local-type-inference.html.html