Skip to content

Confusing language in http://doc.rust-lang.org/book/hello-world.html #20993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mschauer opened this issue Jan 12, 2015 · 4 comments · Fixed by #21011
Closed

Confusing language in http://doc.rust-lang.org/book/hello-world.html #20993

mschauer opened this issue Jan 12, 2015 · 4 comments · Fixed by #21011

Comments

@mschauer
Copy link

In "and because we aren't returning anything from this function, we've dropped THAT notation entirely" it is not clear what is referenced by "that".

@steveklabnik
Copy link
Member

It's referring to the parentheses. Can you think of a suggestion to improve the clarity?

@mschauer
Copy link
Author

To the contents of the parentheses? I understood "because we arent returning anything" to point to dropping the declaration of the return type of the function after an arrow "->".

@steveklabnik
Copy link
Member

Yes, I meant the whole thing: -> ().

@nagisa
Copy link
Member

nagisa commented Jan 12, 2015

These lines define a function in Rust. The main function is special: it's the beginning of every Rust program. The first line says "I'm declaring a function named main, which takes no arguments and returns nothing." If there were arguments, they would go inside the parentheses (( and )), and because we aren't returning anything from this function, we can omit the return type. We'll get to it later.

steveklabnik added a commit to steveklabnik/rust that referenced this issue Jan 12, 2015
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jan 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants