Skip to content

Statements

Statements control execution and side effects within blocks.

Quick patterns

  • Use LET for new bindings and SET for mutation.
  • Guard code with IF and TRY/CATCH.
  • FOR EACH iterates collections; comprehensions provide shorthand for arrays.
  • OUTPUT { ... } shapes final payloads.

Output

OUTPUT specifies how results are emitted from the pipeline.

OUTPUT { id: input.id, total: input.total };

Using

USING references adapters and external modules.

Transform

TRANSFORM defines transformation steps. Use OPTIONS { ... } after the signature to declare per-transform settings.

For loops

FOR and FOR EACH iterate over collections.

FOR EACH item IN input.items WHERE item.qty > 0 {
    OUTPUT { name: item.name, qty: item.qty };
}

If statements

IF provides conditional branching.

IF input.enabled {
    OUTPUT { status: "enabled" };
} ELSE {
    OUTPUT { status: "disabled" };
}

Enumerations

ENUM defines enumerated types inside TYPE declarations.

For each shorthand

FOREACH is a shorthand loop form.

Input

INPUT references the pipeline input data.

Abort

ABORT terminates execution immediately.

Throw

THROW raises an error.

Try/Catch

TRY handles errors and exceptions.

TRY {
    OUTPUT { value: input.value };
} CATCH {
    OUTPUT { value: null };
}

Call

CALL invokes host-provided functions.

CALL inventoryService(input) -> payload;

Shared

SHARED declares shared memory resources.

SHARED session MANY;

Functions

FUNC declares reusable functions.

Types

TYPE declares custom types.

Return

RETURN exits from functions.

Modify

MODIFY changes existing values.

Where

WHERE filters loop iterations and comprehensions.

Set And Plus Assign

SET replaces an existing variable or path value. += updates an explicit local accumulator: it appends one item when the current value is a list, adds numeric values when both sides are numeric, and follows + string concatenation when either side is text.

+= does not create missing variables or intermediate containers. Initialize accumulators with LET before updating them.

Intent Preferred statement style
Replace a local variable SET name = value
Replace an existing path SET object.path = value
Append to an accumulator list items += item
Append to a nested accumulator list state.items += item
Build a new list expression LET next = APPEND(items, item)

SET x = APPEND(x, value) is tolerated when written manually, but it is not the preferred accumulator style. Use x += value for explicit accumulation and keep APPEND(list, value) for expression contexts.