DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B0801: statement form from another language

Catalog status: active. Default severity: error. Stable name: foreign-statement. Family: Syntax and source text.

A statement that C, Java or Rust users write is not part of Varc, or is written differently: i++ and i--, switch, do ... while, and an if or loop without braces.

Example (Varc)

for i in 1..=n {
    if a[i] == 0 count--;
    count++;
}

What to do

Increment with count += 1, branch with match (whose arms never fall through), and write the braces: if a[i] != 0 { count += 1; }.

Regression source and further reading

Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.

See syntax and source text, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.