docs

你正在阅读 v0.1.2 的文档。Nabi 0.1.2 已不再提供支持。 最新版本:v0.1.3 →

本页尚未翻译,以下为英文原文。

#E0012: syntax from another language

The code uses a form Nabi does not have: the c ? a : b operator, ++ / --, or let mut. The message gives the Nabi form: if c { a } else { b }, x += 1, or a plain let (variables are mutable).

nabi
let mut n = 0;
error[E0012]: Nabi has no `let mut`: variables are mutable by default
  --> main.nabi:1:5
   |
 1 | let mut n = 0;
   |     ^^^
   |
   = help: drop `mut`: `let n = ..;`

Drop mut; every variable can be assigned:

nabi
let n = 0;
n += 1;
println(f"{n}");
1

Related: E0010 unexpected token

Found a mistake? Edit this page on GitHub. Last updated