Conditionals
A conditional shows content only when the data agrees. (if @path is
value) … (end) compares; (if @path) … (end) tests
truthiness. Use them for status banners, draft asides, and gated variants.
Comparison
#book: { status - draft } (if @book.status is draft) DRAFT WATERMARK (end)
DRAFT WATERMARK
That renders the watermark. The comparison keyword is is or equals — they are exact synonyms. There is no other operator: no ==, !=, <, >, and no not, and, or, or contains.
Equality coerces to strings
The right-hand side is a bareword or number, and equality stringifies both sides. So a number compares equal to its digits:
#meter: { value - 99 } (if @meter.value is 99) ON TARGET (end)
ON TARGET
That is true — the number 99 stringifies to 99. A record or collection
stringifies to the empty string, so a container never equals a literal
(compare-against-string).
Existence and truthiness
Drop the operator to test whether a value is present and truthy:
#book: { flag - true } (if @book.flag) TRUTHY (end)
TRUTHY
The falsy set is: missing or
unresolved, the empty string, the string false, the number 0, boolean false, null, an empty record {},
and an empty collection []. Everything else is truthy.
Else, empties, and nesting
An (else) branch is optional:
#book: { status - draft } (if @book.status equals final) FINAL (else) NOT FINAL (end)
NOT FINAL
That renders NOT FINAL. Empty then
or else branches are legal no-ops (empty-then-body, empty-else-body), and ifs
nest with their own (end):
(if @lamp.lit) (if @lamp.oil is full) BRIGHT (end) (end)
(nested-ifs; if-end-basic for the plain then-only form.)
The glued-statement gotcha
Because statements need whitespace before the (, a statement glued
to a preceding ) is not recognised and renders
literally:
(each @xs as x)(if @x is a)Y(end)(end) ~ inner (if …) prints as text (each @xs as x) (if @x is a) Y (end) (end) ~ works
Always separate adjacent statements with a space or newline.
Common mistakes
- Reaching for
contains,<,>,and, oror— none exist. - Comparing a whole record to a literal — a container stringifies to empty and never matches.
- Gluing
(ifto a preceding)— keep a space.
See also
Iteration· Data access · Type-classified scalars · Faceted content · Gotchas