Variables
A variable number of variables
A variable is a memory storage used to store a value or a reference. SMLL has two kinds of variable declaration:
In SMLL variable are immutable on the language level and can only be modified by the Java block. This is because SMLL tries to follow the "pure functional programming" approach where functions have no side effects. The Java block is a side effect that is allowed by the language.
Val
The keyword val binds a name, on the left hand side of the expression to a value on the right hand side of the expression. This is similar to how variables work in every other programming language. The val keyword also support value destructuring for struct values.
Let
The let keyword binds a list of names to their corresponding expressions and finally returns a result at the end. This is useful of such cases where code readability is sometimes needed:
From
To
Last updated