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` is not a valid digit in `0b`, which is binary (0-1)mut y: int = 0o8; // ERROR: `8` is not a valid digit in `0o`, which is octal (0-7)mut z: int = 0xZZ; // ERROR: `Z` is not a valid digit in `0x`, which is hexadecimal (0-9, a-f)The 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.