Two modes
ZEN operates in two modes depending on context:| Mode | Used in | Example |
|---|---|---|
| Standard | Expression nodes, output columns | price * quantity * (1 - discount) |
| Unary test | Decision table input columns | >= 100, [1..10], 'US', 'CA' |
Standard mode
Full expressions that return values.Literals
Operators
Arithmetic
| Operator | Description | Example |
|---|---|---|
+ | Addition | 5 + 3 → 8 |
- | Subtraction | 10 - 4 → 6 |
* | Multiplication | 6 * 7 → 42 |
/ | Division | 15 / 3 → 5 |
% | Modulo | 17 % 5 → 2 |
^ | Power | 2 ^ 10 → 1024 |
Comparison
| Operator | Description | Example |
|---|---|---|
== | Equal | x == 5 |
!= | Not equal | x != 0 |
> | Greater than | x > 10 |
< | Less than | x < 100 |
>= | Greater or equal | x >= 18 |
<= | Less or equal | x <= 65 |
Logical
| Operator | Description | Example |
|---|---|---|
and | Logical AND | a and b |
or | Logical OR | a or b |
not | Logical NOT | not a |
Ternary
Null coalescing
Returns the first non-null value:Range check
Property access
Template strings
String slicing
Extract substrings using[start:end] notation:
| Expression | Input | Result |
|---|---|---|
string[0:5] | "sample_string" | "sampl" |
string[7:] | "sample_string" | "string" |
string[:6] | "sample_string" | "sample" |
Unary test mode
Shorthand syntax used in decision table input columns when a field name is defined. The value being tested is implicitly available, allowing you to write conditions without repeating the field name. When an input column has no field name, standard expression mode is used instead.Comparisons
Ranges
Lists
Combined conditions
Functions in unary mode
$ symbol represents the value being tested.
Closures and iteration
The# symbol represents the current element when iterating:
Named aliases
For readability, useas to name the current element:
# but clearer when expressions are complex.
Assignment
Create values and build objects within expressions.Basic assignment
Property assignment
Assign to nested paths — intermediate objects are created automatically:Multiple assignments
Separate with semicolons:Assignment with expressions
Returning values
The last expression determines the return value:$root to return the entire context object.