Control flow
when/if branches, while/until loops, for each, heel/again/bury.
Branches (when / if)
Branch starters: if, when, whenever, should. Must be heard at the start of a branch line (except otherwise when).
Then words: then, do. Else words: otherwise, instead, else.
Block end: bury, end, goodnight, enough, bedtime, lightsout, hush, done, finished.
Inline then (one line, no body lines)
| Line | Parses as | Need to know |
|---|---|---|
when she has 1 toy then heel | IfChain + Break | No bury for single inline step |
when she has 2 toys then she woof "hi" | IfChain + Print | |
when she has 3 toys then I bark "yes" otherwise I bark "no" bury | IfChain + inline else | |
when Bimba has 3 treats then the human growls "Nothing left." otherwise bark "no" | inline if + else | bury optional when all branches inline |
Multiline then / else
| Line | Parses as | Need to know |
|---|---|---|
when she has 2 toys then + body + bury | IfChain | Body lines are normal statements |
otherwise when she has 1 toy then … | second IfBranch | Elif (otherwise when) |
otherwise + body + bury | elseSteps | Final else |
Story glue before print in branches
| Line | Parses as |
|---|---|
when Bimba has 3 treats then the human growls "Nothing left." | IfChain + Print[GROWL]; words before verb are glue |
Full condition grammar: Conditions.
Loops (while / until)
While starters: while, during. Until starters: until, till.
| Line | Parses as | Need to know |
|---|---|---|
while she has more than 0 toys then … bury | WhileLoop | Multiline body needs bury |
until my labrador has 0 toys then … bury | UntilLoop | True condition → exit loop |
while … when she has 1 toy then heel … bury | nested | heel breaks innermost loop |
Inline then (one heel, again, or print on same line) works without bury for that step only.
chaser trait: each loop iteration adds 1 toy before the body runs. See Traits.
Example from loops.woof:
when she has more than 2 toys then
she woofs "Plenty."
she misplaces a toy
otherwise when she has 1 toy then
she woofs "Just one."
otherwise
she woofs "None."
bury
while she has more than 0 toys then
she woofs "Still going."
she misplaces a toy
bury
For each (stash items)
Starters: for each … from … or for each … in …. Each word: each, every.
| Line | Parses as | Need to know |
|---|---|---|
for each snack from cookie_jar then … bury | ForEach[snack, cookie_jar] | Variable name is any identifier |
for each treat from her cookie jar then … | same | Story jar phrase resolves |
for each snack from cookie_jar then bark snack bury | inline body | One print on same line after then |
Each stash item is bound to the variable for one iteration. Loop variable is the only other mutable name besides memory and journal.
Loop control
| Line | Parses as | Synonyms |
|---|---|---|
heel | Break | stop, stay, halt |
again | Continue | repeat, resume, onward |
bury | closes block | See branch section for all bury words |
