Once you write 0x, 0b, or 0o, every digit that follows has to be a
valid digit in that particular base:
- Hexadecimal (
0x) allows 0-9 and a-f (or A-F). - Binary (
0b) allows only 0 and 1. - Octal (
0o) allows only 0-7.
This error means one of the characters right after the prefix isn’t valid for the base you chose – most often a simple typo:
Example
mut x: int = 0b012; // ERROR: '2' isn't valid in binarymut y: int = 0o8; // ERROR: '8' isn't valid in octalmut z: int = 0xZZ; // ERROR: 'Z' isn't a hex digitThe fix depends on what you actually meant:
- If you mistyped a digit, correct it:
Example
mut x: int = 0b010; // fixed- If you actually wanted a plain decimal number, drop the prefix
Example
entirely: mut y: int = 8; // no '0o' needed for an ordinary decimal numberDouble-check which base you meant to use, and that every digit you typed is one that base actually has.
Run turf --explain E071 in a terminal to read this again.