Skip to main content

Let Bindings

You can use the let keyword to bind a value to some name so it can be referenced withing a closure.

info

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

Scope-Local

Since these bindings are local to a closure they can be re-used in different scopes without conflict.

knot
const foo = {
let x = 10;
x + x;
};
const bar = {
let x = 10;
x / x;
};
knot
const foo = {
let x = 10;
x + x;
};
const bar = {
let x = 10;
x / x;
};