Docs / Statements

5. Execution Flow

Control statements behave analogously to C++, but with clean, fast-to-parse syntax. It features C-style loops (`for (let i = 0; i < N; i++)`), iterable iteration loops (`for (element in collection)`), and structured error handling with Try-Catch-Finally.

Structured Exception Handling
 1 try {
 2   let fd = __open("documento_importante.txt", 0);
 3   if (fd < 0) {
 4     throw 5001; // Throws file not found error code
 5   }
 6 } catch (error) {
 7   // Handles the error collected from the call stack
 8   io_write_file("log.err", "Execution failure: ${error}");
 9 } finally {
10   // Always executed to release files, FD connections, or buffers
11   io_write_file("progresso", "Flow finished!");
12 }

Dryad's exception flow guarantees continuous error propagation along the stack in the absence of local handlers.

Found an error in the spec? Open a PR.
Official Version: 1.0 · May 2026