https://doc.rust-lang.org/book/ch04-01-what-is-ownership.html rustbook-en/src/ch04-01-what-is-ownership.md
Extra symbol is {This is probably intentional. After all, βfn main() {
β is the first line of every main
-function.
For further things you notice while reading the book, please consider alternative channels, this forum is probably not the optimal place.
- If you have questions while reading the book or learning Rust, feel free to ask on users.rust-lang.org;
- if you see issues in the book, such as typos, you can find the issue tracker for it on github.com/rust-lang/book/issues
where } ?
this is untrue, main is allowed to return any type that implements Termination
Alright⦠let me amend my statement:
βfn main() {
β is the first line of every main
-function that the book had contained so far. And thus the first line of every main
-function that the book expects you to come up with yourself from that point β at least up to chapter 9 β in order to run the code examples.
Not part of the quotation.
When you have a passage of natural-language text that quotes some computer code, the author of the natural-language text may choose to quote only a fragment of the code -- not enough to be a complete program, or even a complete expression. And that's perfectly fine. In fact, it is often the best way to write something that achieves the goal of the natural-language text, whatever that is.
In the passage you quoted in your original post, I think the point of writing
we won't include all the
fn main() {
code in examples
instead of
we won't include all the
fn main()
code in examples
was to emphasize that the {
, and the matching but unquoted }
, are part of the "boilerplate" that is being omitted from examples below this point, that "you" will have to add manually if you are following along. I might or might not have chosen to do the same, but I don't see anything wrong with it.