Skip to content

Control flow

L executes resolved actions in source order. The examples below distinguish supported source control flow from grammar or backend facilities.

testdata/phase1/language/lang-13.l
Use IO's Print from `io` as "Print".
"message" is `condition`.
"enabled" is true.
Create "Worker" as a New Basic App.
The App Prints message.
Run Worker.
If enabled equals true, await Worker, else exit.
Define "result" as Worker's Output.
Show result.

Complete program. Source: testdata/phase1/language/lang-13.l.

Example evidence

Complete LANG-13 program: Truth equality chooses Await and then reads finalized App output. Existing native witness, not run here. existing-witness-not-run. Evidence guide.

If enabled equals true, await Worker, else exit. has a condition, a comma before the selected action, and an optional else action. Here the true branch joins Worker; the false branch terminates the program. Only the joined path reaches Output. Expected stdout is condition\n.

Otherwise can supply the alternative to an immediately preceding unmatched If in the same paragraph:

lyger/test/member-resolution.l (lines 7–9)
If it has an Error, exit with the Error, else define "y" as it's Output.
If x isnt y, exit with an error of `text values of both x & y should be Hello World`.
Otherwise, show y and then exit.

Fragment. Source: lyger/test/member-resolution.l (lines 7–9).

Example evidence

Conditional ownership excerpt from the member-resolution frontend witness; preceding App, x, and execution omitted. No successful runtime claim. existing-witness-not-run. Evidence guide.

This excerpt requires the fixture's earlier App and Text declarations. The inline else belongs to the Error test; Otherwise belongs to If x isnt y. It cannot attach across a blank paragraph boundary or intervening statement. This is a binding witness, not a successful output recipe: the fixture compares Text with newline-bearing Print output.

Bare Exit ends the whole program, including from a continuation, and succeeds if cleanup succeeds. The error-Exit example instead writes First\n to stdout, paragraph stopped\n to stderr and exits 1; later actions do not run.

demo/phase1/main.l
Use IO's Print from `io` as "Print".
"firstText" is `First`.
"secondText" is `Second`.
Create "First" as a New Basic App.
The App Prints firstText.
Create "Second" as a New Basic App.
The App Prints secondText.
Start First and Second.
Await Second and First.
Show First's Output.
Show Second's Output.

Complete program. Source: demo/phase1/main.l.

Example evidence

Launch two Apps, join in reverse order, show output in explicit source order. existing-witness-not-run. Evidence guide.

Start expands Build/Run for First, then Second. Their processes may overlap. Await joins Second before First; the Shows choose display order, producing First\nSecond\n.

Execute First and Second instead completes Start/Await and the continuation for First before starting Second. Coordinating action operands with and is supported; joining boolean conditions with and or or is rejected. See comparisons and selection for exact forms, including isnt and Error checks.

A value must be assigned on every path that continues to its use; Exit paths cannot reach later reads. The compiler supplies neither hidden defaults nor blanket cloning. Output readiness is checked separately at runtime.

Iteration has a bounded implementation surface

Section titled “Iteration has a bounded implementation surface”

While is rejected in the enclosing program; general source collection iteration is unsupported. Backend loop compositions do not supply L for/while syntax, arithmetic precedence or short-circuit guarantees. The iteration reference and Lucid suite document compile-only backend witnesses and unsupported forms.

Continue with imports and dictionaries.


Canonical source: docs/guide/control-flow.md.