Language CoreM2
Control Flow & Lexical Scoping
if/else, while, for, break, continue, and strict block scoping semantics.
5 min readUpdated: v0.8.0-rc Reference
Conditionals & Loops
Every control body (if, else, while, for) introduces its own lexical block scope—even single-statement unbraced bodies never leak declarations into the enclosing scope.
hadid · EN
i32 even_sum = 0;for (i32 i = 1; i <= 10; i = i + 1) { if (i % 2 != 0) { continue; } even_sum = even_sum + i; if (even_sum >= 20) { break; }}print(even_sum);hadid · EN
i32 n = 5;i32 acc = 1;while (n > 1) { acc = acc * n; n = n - 1;}print(acc);