docs

You are reading the docs for v0.1.2. Nabi 0.1.2 is no longer supported. Latest release: v0.1.3 →

#E0100: pattern does not fit the value's type

A pattern cannot match a value of this type: a struct pattern of another struct, a tuple pattern on a value that is not a tuple, or a refutable pattern where only an irrefutable one goes (let, parameters, for). Write a pattern of the value's type, and use match or let .. else for refutable ones.

nabi
let n = 5;
let (a, b) = n;
error[E0100]: tuple destructure of a non-tuple value of type `i64`
  --> main.nabi:2:1
   |
 2 | let (a, b) = n;
   | ^^^

Destructure a value of the pattern's type:

nabi
let pair = (5, 6);
let (a, b) = pair;
println(f"{a} {b}");
5 6

Related: E0101 wrong number of fields in a pattern, E0060 let .. else that does not diverge

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