mutable closures (let variables)

This commit is contained in:
Dmitry Vasilev
2023-11-17 12:44:12 +08:00
parent 924e59f567
commit 4b32433748
10 changed files with 1272 additions and 157 deletions

View File

@@ -33,17 +33,7 @@ Leporello.js source code is developed within Leporello.js itself
## Supported javascript subset
Variables are declared using the `const` declaration. The use of `var` is not supported. `let` variables can be declared without an initial assignment, which is useful in cases where the value depends on a condition. Here's an example:
```
let result
if (n == 0 || n == 1) {
result = n
} else {
result = fib(n - 1) + fib(n - 2)
}
```
Currently, only a single declaration for a single `const` statement is supported (TODO).
Variables are declared using the `const` or 'let' declaration. The use of `var` is not supported.
Loops of any kind are not supported. Instead, consider using recursion or array functions as alternatives.