Error in documentation

Hi there is a glitch in the documentation at: part comparing the guess with secret number

The book instead write it correctly

Regards

aurelien

You should be more clear about what you mean. Even reading the whole thing in your screenshot, I couldn’t find the error you were hinting at; even if there is an error, you should pinpoint it exactly, explain it, and probably also provide a link to the page instead of just a screenshot.

In case you’re referring to the “A👍%” as a “glitch”, that part is intentional. You can indeed not parse that string as a number, e.g.

fn main() {
    let s = "A👍%";
    match s.parse::<i32>() {
        Ok(n) => println!("successfully parsed: {n}"),
        Err(e) => println!("error parsing {s:?}: {e}"),
    }
}

will print

error parsing "A👍%": invalid digit found in string
2 Likes