@let
Declares named constants, read back with {{name}}.
On this page
#Examples
@let(source-note: Johnson & Raven (1973))
As reported in {{source-note}}.@let(
plants: 240
site: Baltra
)
@let(per-day: {{plants / 8}})
We surveyed {{plants}} plants on {{site}}, {{per-day}} a day.#Notes
- The attribute group is the bindings, so
has no attributes and no implicit value of its own: @let takes no implicit attribute — its attribute group holds the author's bindings. - A constant is visible after its
, inside the construct that holds it. Read before it, it is undefined constantk. - A key declared again in the same scope replaces the earlier value. One declared in a scene hides the document's inside that scene.
- The bindings of one group cannot read each other; a constant computed from another goes in a later
. - A bare key is
true:(answers). bodyanddetailare reserved, because a@definetemplate uses them for its sections:bodyis a reserved constant name.- A value's text takes the type of the position it lands in, and never adds structure: a value beginning
-on a line of its own is a paragraph, not a list item. - A constant can be applied with
->:(parties: (DEM: blue; otherwise: grey)), thencolour: #d.party -> parties. - A constant may hold a bound value such as
{{#f.slope}}; a position that refuses bound values refuses it where the constant is used. - A table of values is a
dataset, not a constant.
#Writing guidance
- Source style — The conventions that keep a .chalk file legible to the next person editing it by hand.