ALPHA: breaking changes expected. What that means
NanoC

Control flow

Same semantics as C, written with indentation. There are no braces, no then and no block colons.

Today

NanoC
f sum(a: *i32, n: i32) i32
  total := 0
  for i := 0; i < n; i++
    if a[i] < 0
      ^
    elif a[i] == 0
      !
    else
      total += a[i]
  while total > 10
    total--
  < total
f main
  v: i32[] = {4, -1, 9, 0, 7}
  sum(v, 5) != 10
C
int sum(int *a, int n) {
    int total = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] < 0) {
            continue;
        } else if (a[i] == 0) {
            break;
        } else {
            total += a[i];
        }
    }
    while (total > 10) {
        total--;
    }
    return total;
}

int main(void) {
    int v[] = {4, -1, 9, 0, 7};
    return sum(v, 5) != 10;
}
WordC
if / elif / elseif / else if / else
while condwhile
for init; cond; stepfor
!break
^continue
< valuereturn value

Indentation is two spaces. A body must be deeper than its header and siblings must align; the compiler reports inconsistent indentation as an error.

Target: if as an expression

In the new core if also produces a value, so a conditional initializer needs no temporary or ternary.

NanoC, new syntax (preview, not compiled yet)
f pick(a: i32) i32
  r := if a == 1  2  else 3
  r