🐐 Unpacking arrays

This commit is contained in:
2026-04-21 14:54:36 +02:00
parent c28ffbbf45
commit 63c35605a2
7 changed files with 127 additions and 4 deletions

View File

@@ -34,6 +34,21 @@ Variable can consist of lower-case letters, numbers, as well as `_`.
`x AVGE III` is equivalent to `DESIGNA x VT x + III`.
### Destructuring
Multiple variables can be assigned at once by unpacking an array or multi-return function:
```
DEFINI pair (a, b) VT { REDI (a, b) }
DESIGNA x, y VT INVOCA pair (III, VII)
```
The number of targets must match the length of the array. This also works with array literals:
```
DESIGNA a, b, c VT [I, II, III]
```
## Data types
### NVLLVS
`NVLLVS` is a special kind of data type in `CENTVRION`, similar to the `null` value in many other languages. `NVLLVS` can be 0 if evaluated as an int or float, or an empty string if evaluated as a string. `NVLLVS` cannot be evaluated as a boolean.