Skip to content

Commit dc03639

Browse files
committed
---
yaml --- r: 30727 b: refs/heads/incoming c: ba8750a h: refs/heads/master i: 30725: beaaf8c 30723: 8eb1bab 30719: 6c92920 v: v3
1 parent 3b14e8c commit dc03639

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: a8406e3d00ca791317f85d369e6157e4b5a2cf90
9+
refs/heads/incoming: ba8750a5503242828ca0d95177196ebe6d7cbf51
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/doc/tutorial.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,8 @@ you use the matching to get at the contents of data types. Remember
580580
that `(float, float)` is a tuple of two floats:
581581

582582
~~~~
583-
use float::consts::pi;
584583
fn angle(vector: (float, float)) -> float {
584+
let pi = float::consts::pi;
585585
match vector {
586586
(0f, y) if y < 0f => 1.5 * pi,
587587
(0f, y) => 0.5 * pi,
@@ -601,23 +601,19 @@ an expression of type `bool` that determines, after the pattern is
601601
found to match, whether the arm is taken or not. The variables bound
602602
by the pattern are available in this guard expression.
603603

604-
## Let
605-
606-
You've already seen simple `let` bindings. `let` is also a little fancier: it
607-
is possible to use destructuring patterns in it. For example, you can say this
608-
to extract the fields from a tuple:
604+
You've already seen simple `let` bindings, but `let` is a little
605+
fancier than you've been led to believe. It too supports destructuring
606+
patterns. For example, you can say this to extract the fields from a
607+
tuple, introducing two variables, `a` and `b`.
609608

610609
~~~~
611610
# fn get_tuple_of_two_ints() -> (int, int) { (1, 1) }
612611
let (a, b) = get_tuple_of_two_ints();
613612
~~~~
614613

615-
This will introduce two new variables, `a` and `b`, bound to the
616-
content of the tuple.
617-
618-
You may only use *irrefutable* patterns—patterns that can never fail to
619-
match—in let bindings. Other types of patterns, such as literals, are
620-
not allowed.
614+
Let bindings only work with _irrefutable_ patterns, that is, patterns
615+
that can never fail to match. This excludes `let` from matching
616+
literals and most enum variants.
621617

622618
## Loops
623619

0 commit comments

Comments
 (0)