Format Strings

Builder supports format strings for string interpolation using the ..FMT() syntax.

Basic Syntax

x <- 1
y <- 2
print(..FMT("{x} + {y} = {x + y}"))

Expands to:

x <- 1
y <- 2
print(sprintf('%s + %s = %s', x, y, x + y))

Examples

Variable Interpolation

name <- "Alice"
age <- 30
print(..FMT("Hello {name}, you are {age} years old"))

Expression Evaluation

Expressions inside {} are evaluated:

x <- 10
print(..FMT("Double: {x * 2}, Square: {x ^ 2}"))

Function Calls

values <- c(1, 2, 3)
print(..FMT("Sum is {sum(values)}"))

Quote Styles

Both single and double quotes are supported:

..FMT("hello {name}")
..FMT('hello {name}')

Limitations