🐐 String interpolation
This commit is contained in:
15
README.md
15
README.md
@@ -65,6 +65,21 @@ Strings are concatenated with `&`:
|
||||
|
||||
`NVLLVS` coerces to an empty string when used with `&`. Note: `+` is for arithmetic only — using it on strings raises an error.
|
||||
|
||||
#### String Interpolation
|
||||
|
||||
Double-quoted strings support interpolation with `{expression}`:
|
||||
|
||||
```
|
||||
DESIGNA nomen VT "Marcus"
|
||||
DICE("Salve, {nomen}!") // → Salve, Marcus!
|
||||
DICE("Sum: {III + IV}") // → Sum: VII
|
||||
DICE("{nomen} has {V} cats") // → Marcus has V cats
|
||||
```
|
||||
|
||||
Any expression can appear inside `{}`. Values are coerced to strings the same way as with `&` (integers become Roman numerals, booleans become `VERITAS`/`FALSITAS`, etc.).
|
||||
|
||||
Single-quoted strings do **not** interpolate — `'{nomen}'` is the literal text `{nomen}`. Use `{{` and `}}` for literal braces in double-quoted strings: `"use {{braces}}"` → `use {braces}`.
|
||||
|
||||
Integer modulo is `RELIQVVM`: `VII RELIQVVM III` evaluates to `I`. Under the `FRACTIO` module it returns a fraction, so `IIIS RELIQVVM IS` is `S` (i.e. 1/2).
|
||||
|
||||
### Integers
|
||||
|
||||
Reference in New Issue
Block a user