Skip to content

Commit d7b29a6

Browse files
committed
Make note that examples need a main()
Fixes #19199
1 parent 48ca6d1 commit d7b29a6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/doc/guide.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,15 @@ of your time with Rust.
378378
The first thing we'll learn about are 'variable bindings.' They look like this:
379379

380380
```{rust}
381-
let x = 5i;
381+
fn main() {
382+
let x = 5i;
383+
}
382384
```
383385

386+
Putting `fn main() {` in each example is a bit tedious, so we'll leave that out
387+
in the future. If you're following along, make sure to edit your `main()`
388+
function, rather than leaving it off. Otherwise, you'll get an error.
389+
384390
In many languages, this is called a 'variable.' But Rust's variable bindings
385391
have a few tricks up their sleeves. Rust has a very powerful feature called
386392
'pattern matching' that we'll get into detail with later, but the left

0 commit comments

Comments
 (0)