From 3691b9cf65a88cb20b7fe19ecf80722668564539 Mon Sep 17 00:00:00 2001 From: shivansh-engineer Date: Tue, 5 May 2026 13:39:21 -0700 Subject: [PATCH] docs: add conditionals section to syntax reference --- apps/docs/docs/language/syntax.mdx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/docs/docs/language/syntax.mdx b/apps/docs/docs/language/syntax.mdx index 35087b9..9a52700 100644 --- a/apps/docs/docs/language/syntax.mdx +++ b/apps/docs/docs/language/syntax.mdx @@ -149,6 +149,24 @@ variables: - `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`). - `empty` -- Explicitly marks a block as having no content (e.g., `connection slack: empty`) +## Conditionals + +Inside a procedure, `if`, `elif`, and `else` control which statements execute based on runtime values: + +```agentscript +instructions: -> + if @variables.loyalty_tier == "Premium": + | You are eligible for a free return. + elif @variables.return_eligible == True: + | Processing your return request. + else: + | Please contact support for assistance. +``` + +- `elif` and `else` are optional. +- Multiple `elif` branches are supported. +- The body of each branch is indented one level and can contain any procedure statements — template lines, `set`, `run`, or `transition`. + ## Line Continuation Use `\` at the end of a line to continue a statement on the next line: