These are the constructs you use inside a route or task to branch, loop, transform
data, and compose values. The declarative keywords (route, schema, and so on) are
in Keywords.
Conditionals
if / else works as a statement and as an expression that produces a value:
status = if cached
cached
else
"fresh"Pattern matching
match tests a value against patterns, with fallback as the default branch:
label = match status
"active" -> "on"
fallback -> "off"Loops
while repeats a block while its condition holds:
counter = 0
while counter < 3
counter = counter + 1Pipelines
>> passes the result of each step to the next, which reads left to right instead of
nesting calls. It drives database queries, HTTP calls, and collection transforms:
recent = db.orders >> where(active: true) >> order_by("id desc") >> fetchBroadcast
*>> sends the same value to several branches and collects their results positionally
into a list. The runtime runs independent branches (outbound calls, separate queries) in
parallel, so they overlap instead of waiting on each other:
sections = user_id *>>
-> load_profile
-> load_orders
-> load_recommendationsSee Broadcast for how the parallelism, result order, and the runtime’s optimization of trivial branches work.
Boolean operators
and, or, and not combine booleans. or also supplies a default when the left
side is null or false:
name = user.name or "guest"
allowed = user.active and not user.bannedCollections
Transform a list with map, emitting values with keep and dropping elements with
skip, and fold a list with reduce:
names = users >> map user
skip if not user.active
keep user.name
total = prices >> reduce(0) acc, item
acc + item