Skip to main content

E0001: Unknown Variable

You tried to use a variable that hasn't been declared.

Example

fn main() {
let x = y + 1; // Error: `y` is not defined
}

How to fix

Make sure the variable is declared before you use it:

fn main() {
let y = 10;
let x = y + 1; // OK
}

Or check for typos in the variable name.