Skip to content

Control Flow

Nika Natsvlishvili edited this page Dec 29, 2025 · 1 revision

🔀 Control-Flow.md

Discernment (If / Else)

Logos uses discern and otherwise for conditional logic.

inscribe gold = 10;

discern (gold > 100) {
    proclaim "We are wealthy.";
} otherwise {
    proclaim "We must live humbly.";
} amen

Chants (Loops)

Repetitive tasks are handled by chant (equivalent to while).

inscribe i = 0;
chant i < 5 {
    proclaim i;
    amend i = i + 1;
} amen

Contemplation (Pattern Matching)

A powerful alternative to switch or if/else chains. Use aspect to match values and _ for wildcards.

inscribe status = 200;

contemplate (status) {
    aspect 200: proclaim "OK";
    aspect 404: proclaim "Not Found";
    aspect _:   proclaim "Unknown State";
} amen

Clone this wiki locally