Basics
Parameters
Learn about positional, named, and array parameters in Tiramisu function calls.
Function calls in Tiramisu can accept parameters. Parameters are separated by commas and come in three forms: positional, named, and arrays.
Positional Parameters
Content separated by commas creates positional parameters:
func { first, second, third } Each comma-separated value becomes a separate positional parameter in the AST.
Named Parameters
Use = to create named parameters:
link { url = https://example.com, Click here } In this example, url is a named parameter with value https://example.com, and "Click here" is a positional parameter.
Mixing Parameters
Named and positional parameters can be mixed freely:
image {
src = /photo.jpg,
alt = A beautiful sunset,
My image caption
} Array Parameters
Use square brackets to create array values:
table {
row = [Name, Age, City],
row = [Alice, 30, Portland],
row = [Bob, 25, Seattle]
} Each [] creates an array value. Array items are separated by commas.
Whitespace
Whitespace around parameters is trimmed. These are equivalent:
bold{text}
bold { text }
bold {
text
} Commas in Content
If your content contains commas, you need to either escape them or use quotes:
// Escape with backslash
func { hello\, world }
// Or use quotes
func { "hello, world" } Without escaping, the comma would split the content into two separate parameters.