]> git.lizzy.rs Git - rust.git/blobdiff - src/doc/guide.md
rollup merge of #19310: steveklabnik/gh19178
[rust.git] / src / doc / guide.md
index 8f2aea0de54d7dc93585f44c5387b1c051834d9d..4387ff7ccfc5bb8aa2e95c6f23ac2d49c549bbf6 100644 (file)
@@ -378,9 +378,15 @@ of your time with Rust.
 The first thing we'll learn about are 'variable bindings.' They look like this:
 
 ```{rust}
-let x = 5i;
+fn main() {
+    let x = 5i;
+}
 ```
 
+Putting `fn main() {` in each example is a bit tedious, so we'll leave that out
+in the future. If you're following along, make sure to edit your `main()`
+function, rather than leaving it off. Otherwise, you'll get an error.
+
 In many languages, this is called a 'variable.' But Rust's variable bindings
 have a few tricks up their sleeves. Rust has a very powerful feature called
 'pattern matching' that we'll get into detail with later, but the left