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
- TypeScript
knot
const MY_CONST = "my const";
knot
const MY_CONST = "my const";
tsx
const MY_CONST = "my const";
tsx
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
- TypeScript
knot
func closureExample(value: integer) -> {let result = value + 6;result;}
knot
func closureExample(value: integer) -> {let result = value + 6;result;}
tsx
function closureExample(value: number) {let result = value + 6;return result;}
tsx
function closureExample(value: number) {let result = value + 6;return result;}