Skip to content

[guide] variable binding outside a function  #19199

Closed
@evangoer

Description

@evangoer

If the reader starts section 4 and tries to play around with variables by doing a bare let x = 5i;, they'll run into the error:

variables.rs:1:1: 1:4 error: expected item, found `let`

The guide should update the first few examples in section 4 to explicitly show let declared inside a function, so that the code will compile. This would also be a good place to explain why declaring the let outside fn yields an error.

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