Skip to content

[guide] variable binding outside a function  #19199

@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.

Activity

added a commit that references this issue on Nov 25, 2014
d7b29a6
evangoer

evangoer commented on Nov 29, 2014

@evangoer
Author

Well done, thank you all! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @steveklabnik@evangoer

      Issue actions

        [guide] variable binding outside a function · Issue #19199 · rust-lang/rust