🐐 TEMPTA/CAPE

This commit is contained in:
2026-04-21 23:19:45 +02:00
parent 9003d49b20
commit afb1622b3a
10 changed files with 229 additions and 7 deletions

View File

@@ -240,6 +240,24 @@ condition. Exit the loop with `ERVMPE` (or `REDI` from inside a function).
> V
```
## Error handling
Errors can be caught using `TEMPTA` (temptare = to try) and `CAPE` (capere = to catch). The `CAPE` block binds the error message to a variable as a string.
```
TEMPTA {
DESIGNA x VT I / NVLLVS
} CAPE error {
DICE(error)
}
```
```
> Division by zero
```
If the try block succeeds, the catch block is skipped. If an error occurs in the catch block, it propagates up. `TEMPTA`/`CAPE` blocks can be nested.
## Functions
Functions are defined with the `DEFINI` and `VT` keywords. The `REDI` keyword is used to return. `REDI` can also be used to end the program, if used outside of a function.