Let statement

A let statement introduces a new set of variables, given by an irrefutable pattern. The pattern is followed optionally by a type annotation and then by an initializer expression. Variables are always initialized to some value.

When no type annotation is given, the compiler infers the type, or signals an error if insufficient type information is available for definite inference.

Any variable introduced by a this declaration is visible from the point of declaration until the end of the enclosing block scope, except when it is shadowed by another variable declaration.