Skip to content

Chapter 2 should explain that read_line appends to String. #2574

@nothingnesses

Description

@nothingnesses

I recently ran into an issue because I wrongly assumed that read_line overwrites the contents of a String instead of appending to it. I think a factor in this was that the explanation for the behaviour of read_line in Chapter 2 was a bit ambiguous. It turns out, I wasn't alone either, as someone else did something similar.

To prevent confusion in the future, I think it would be better if this sentence is changed to something like:

The job of `read_line` is to take whatever the user types into standard input
and append that into a string, so it takes that string as an argument.

Or even:

The job of `read_line` is to take whatever the user types into standard input
and append that into a string (without overwriting its contents), so it takes
that string as an argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions