LYR-SEM0058
a destructuring that does not fit the value
A let (a, b) = … takes apart a value that is not a tuple, or binds a different number of names than the tuple has elements.
Explanation
A destructuring binding takes a tuple apart element by element, so the value must be a tuple and the pattern must name each of its elements once.
Bind as many names as the tuple has elements (use _ for an element you do not need), or bind the value whole.
Wrong
fn main(): void {
let (a, b) = (1, 2, 3);
let _ = a + b;
}
Right
fn main(): void {
let (a, b, c) = (1, 2, 3);
let _ = a + b + c;
}