Skip to content
This repository was archived by the owner on Nov 11, 2019. It is now read-only.
This repository was archived by the owner on Nov 11, 2019. It is now read-only.

Guessing Game: Number input fails to produce Option int, instead produces Option none #48

Closed
@listless

Description

@listless

Running the Guessing Game program at the end of Chapter 11, it does not seem to recognise when I enter a number, instead always producing options of type none, I fixed this by changing
let num = from_str::<int>(input.slice_to(input.len() - 1));
to
let num = from_str::<int>(input.slice_to(input.len() - 2));
because I suspected that this method was trying to remove the \n from the end of the input string, and \n would be two characters.

Sorry, new to github so I believed this would be the best place to post about this, can this problem be confirmed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions