Skip to content

Commit 3691b9c

Browse files
docs: add conditionals section to syntax reference
1 parent 342ea6b commit 3691b9c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

apps/docs/docs/language/syntax.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,24 @@ variables:
149149
- `2025-09-04`, `2025-09-04T12:01Z` -- Datetime literals in ISO 8601 format. Supported formats include date only (`YYYY-MM-DD`), date with time (`YYYY-MM-DDThh:mm`), and date with seconds and timezone (`YYYY-MM-DDThh:mm:ssZ`).
150150
- `empty` -- Explicitly marks a block as having no content (e.g., `connection slack: empty`)
151151

152+
## Conditionals
153+
154+
Inside a procedure, `if`, `elif`, and `else` control which statements execute based on runtime values:
155+
156+
```agentscript
157+
instructions: ->
158+
if @variables.loyalty_tier == "Premium":
159+
| You are eligible for a free return.
160+
elif @variables.return_eligible == True:
161+
| Processing your return request.
162+
else:
163+
| Please contact support for assistance.
164+
```
165+
166+
- `elif` and `else` are optional.
167+
- Multiple `elif` branches are supported.
168+
- The body of each branch is indented one level and can contain any procedure statements — template lines, `set`, `run`, or `transition`.
169+
152170
## Line Continuation
153171

154172
Use `\` at the end of a line to continue a statement on the next line:

0 commit comments

Comments
 (0)