about summary refs log tree commit diff
path: root/src/doc/tutorial.md
diff options
context:
space:
mode:
authorMike Boutin <mike.boutin@gmail.com>2014-04-26 11:41:23 -0400
committerMike Boutin <mike.boutin@gmail.com>2014-05-05 11:24:00 -0400
commit81bc32d9750f34a2218e6ba8f2d2c1a101f8a8a1 (patch)
tree025e37297a0a0f2e7f53c35c780628d3a87e82bf /src/doc/tutorial.md
parentecc18f34446cdecd42004be62805f84799733e72 (diff)
downloadrust-81bc32d9750f34a2218e6ba8f2d2c1a101f8a8a1.tar.gz
rust-81bc32d9750f34a2218e6ba8f2d2c1a101f8a8a1.zip
doc: Clarified 4.2 Pattern matching
Combined redundant paragraphs about the match expression and removed a
redundant example.
Diffstat (limited to 'src/doc/tutorial.md')
-rw-r--r--src/doc/tutorial.md23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md
index f14b7833800..d64af8e2c65 100644
--- a/src/doc/tutorial.md
+++ b/src/doc/tutorial.md
@@ -468,19 +468,16 @@ Unlike in C, there is no "falling through" between arms: only one arm
 executes, and it doesn't have to explicitly `break` out of the
 construct when it is finished.
 
-A `match` arm consists of a *pattern*, then an arrow `=>`, followed by
-an *action* (expression). Literals are valid patterns and match only
-their own value. A single arm may match multiple different patterns by
-combining them with the pipe operator (`|`), so long as every pattern
-binds the same set of variables. Ranges of numeric literal patterns
-can be expressed with two dots, as in `M..N`. The underscore (`_`) is
-a wildcard pattern that matches any single value. (`..`) is a different
-wildcard that can match one or more fields in an `enum` variant.
-
-The patterns in a match arm are followed by a fat arrow, `=>`, then an
-expression to evaluate. Each case is separated by commas. It's often
-convenient to use a block expression for each case, in which case the
-commas are optional.
+A `match` arm consists of a *pattern*, then a fat arrow `=>`, followed
+by an *action* (expression). Each case is separated by commas. It is
+often convenient to use a block expression for each case, in which case
+the commas are optional as shown below. Literals are valid patterns and
+match only their own value. A single arm may match multiple different
+patterns by combining them with the pipe operator (`|`), so long as every
+pattern binds the same set of variables. Ranges of numeric literal
+patterns can be expressed with two dots, as in `M..N`. The underscore
+(`_`) is a wildcard pattern that matches any single value. (`..`) is a
+different wildcard that can match one or more fields in an `enum` variant.
 
 ~~~
 # let my_number = 1;