Skip to content

Commit

Permalink
Make an example more clear with sample code.
Browse files Browse the repository at this point in the history
  • Loading branch information
steveklabnik committed Jun 25, 2014
1 parent d77cb22 commit 53627dd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,14 @@ tuple, introducing two variables at once: `a` and `b`.
let (a, b) = get_tuple_of_two_ints();
~~~~

Let bindings only work with _irrefutable_ patterns: that is, patterns
that can never fail to match. This excludes `let` from matching
literals and most `enum` variants.
Let bindings only work with _irrefutable_ patterns: that is, patterns that can
never fail to match. This excludes `let` from matching literals and most `enum`
variants as binding patterns, since most such patterns are not irrefutable. For
example, this will not compile:

~~~~{ignore}
let (a, 2) = (1, 2);
~~~~

## Loops

Expand Down

1 comment on commit 53627dd

@alexcrichton
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.