docs

你正在阅读 v0.1.0 的文档。Nabi 0.1.0 已不再提供支持。 最新版本: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