Skip to main content

Variables

Reference data by storing it in a variable; it's the way of the future!

info

Variables in Knot are immutable except for within the scope of state entities (coming soon!).

Constants

Constants are statically declared within a module and can be referenced within that module or outside of it by way of an import.

knot
const MY_CONST = "my const";
knot
const MY_CONST = "my const";

Let Bindings

Variables can be declared within any closure (such as in a view or a func) and referenced by other expressions within the same closure.

knot
func closureExample(value: integer) -> {
let result = value + 6;
result;
}
knot
func closureExample(value: integer) -> {
let result = value + 6;
result;
}