docs

您正在閱讀 v0.1.2 的文件。Nabi 0.1.2 已停止支援。 最新版本:v0.1.3 →

本頁尚未翻譯,以下為英文原文。

#E0029: cannot find enum variant

The enum has no variant of this name. Check the spelling against the enum's definition.

nabi
enum Light { Red, Green }

let l = Light::Yellow;
error[E0029]: enum `Light` has no variant `Yellow`
  --> main.nabi:3:9
   |
 3 | let l = Light::Yellow;
   |         ^^^^^^^^^^^^^

Use a variant the enum has, or add it to the enum:

nabi
#[derive(PartialEq)]
enum Light { Red, Green, Yellow }

let l = Light::Yellow;
println(f"{l == Light::Yellow}");
true

Related: E0027 cannot find value or function, E0103 binding looks like a variant

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