#E0001: unexpected character in source
The source has a character that starts no token: a stray # or $, a #! line after the first line, a combining mark with no letter before it, a code point Unicode leaves unassigned, or an operator symbol such as ⊛ that no trait in scope registers. Remove it, or write it inside a string or comment. An operator symbol needs the package that registers it as a dependency, or an #[infix(..)] on a trait method of yours.
let price = $5;
error[E0001]: unexpected character(s) `$` --> main.nabi:1:13 | 1 | let price = $5; | ^
Remove the stray character, or put it inside a string. A number with a unit is a suffix name glued to it (5usd), not a symbol (E0114):
let price = 5;
println(f"${price}");
$5
Related: E0002 bidirectional control character in source, E0010 unexpected token, E0148 character that only looks like a token
Found a mistake? Edit this page on GitHub. Last updated