docs

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

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

#E0101: wrong number of fields in a pattern

A tuple or variant pattern has more or fewer parts than the value. Match each part, or use .. for the rest.

nabi
let t = (1, 2, 3);
let (a, b) = t;
error[E0101]: tuple destructure length mismatch: pattern has 2 elements, value has 3
  --> main.nabi:2:1
   |
 2 | let (a, b) = t;
   | ^^^

Match every part, or use .. for the rest:

nabi
let t = (1, 2, 3);
let (a, ..) = t;
println(f"{a}");
1

Related: E0100 pattern does not fit the value's type, E0104 invalid rest pattern

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