docs

#E0012: 來自其他語言的語法

程式碼使用了 Nabi 沒有的寫法:c ? a : b 運算子、++ / -- 或 let mut。訊息會給出 Nabi 的寫法:if c { a } else { b }、x += 1,或單純的 let(變數是可變的)。

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 = ..;`

去掉 mut;每個變數都可以指派:

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

相關錯誤碼:E0010 非預期的語彙單元

發現錯誤? 在 GitHub 上編輯此頁 最後更新: