§4 Statements and Control Flow
// Variableslet x = 10;let mut y = 0;
// Conditionalsif x > 5 { y = 1;} else if x == 5 { y = 0;} else { y = -1;}
// For loopfor item in items { process(item);}
// Loop with break condition (Sailfin has no `while` — see Part B)loop { if queue.length == 0 { break; } handle(queue.pop());}
// Loop with break valuelet result = loop { let val = compute(); if val > threshold { break val; }};
// Match — see stability note belowmatch status { "active" => activate(), "paused" => pause(), _ => print.err("Unknown: {{ status }}"),}
// Try / catch / finally (err is bare, no type annotation)try { let data = fs.read(path); process(data);} catch (err) { print.err("Read failed: {{ err }}"); throw err;} finally { cleanup();}Assignment operators: =, +=, -=, *=, /=
Note on
matchstability:matchis parsed and emits IR, but LLVM lowering of common match patterns (number literals, enum variants) may trigger crashes or incorrect codegen in the current compiler. String pattern matching (as shown above) is more reliable. Move complex match expressions to Part B patterns or useif/else ifchains until lowering stabilizes.