about summary refs log tree commit diff
path: root/src/doc/reference.md
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-11-17 11:31:13 -0500
committerSteve Klabnik <steve@steveklabnik.com>2015-11-17 17:41:26 -0500
commitcf384c21eae3f9bd7e8d1f76ced8ad7199cd02f4 (patch)
tree7a369f2aee667e54a0bc9ccd6f97c3a269ea8801 /src/doc/reference.md
parent57c8a3e8b6a3200bb01d0ea60e4686a1ecfcb907 (diff)
downloadrust-cf384c21eae3f9bd7e8d1f76ced8ad7199cd02f4.tar.gz
rust-cf384c21eae3f9bd7e8d1f76ced8ad7199cd02f4.zip
Clear up the reference around let
First, re-word the section on if let/while let to be more clear.

Second, actually call them let statements in the statement section

Fixes #29801
Diffstat (limited to 'src/doc/reference.md')
-rw-r--r--src/doc/reference.md23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/doc/reference.md b/src/doc/reference.md
index de9352a4275..b057b846be7 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -2415,9 +2415,9 @@ in meaning to declaring the item outside the statement block.
 > **Note**: there is no implicit capture of the function's dynamic environment when
 > declaring a function-local item.
 
-#### Variable declarations
+#### `let` statements
 
-A _variable declaration_ introduces a new set of variable, given by a pattern. The
+A _`let` statement_ introduces a new set of variables, given by a pattern. The
 pattern may be followed by a type annotation, and/or an initializer expression.
 When no type annotation is given, the compiler will infer the type, or signal
 an error if insufficient type information is available for definite inference.
@@ -3190,10 +3190,11 @@ let message = match maybe_digit {
 
 ### `if let` expressions
 
-An `if let` expression is semantically identical to an `if` expression but in place
-of a condition expression it expects a refutable let statement. If the value of the
-expression on the right hand side of the let statement matches the pattern, the corresponding
-block will execute, otherwise flow proceeds to the first `else` block that follows.
+An `if let` expression is semantically identical to an `if` expression but in
+place of a condition expression it expects a `let` statement with a refutable
+pattern. If the value of the expression on the right hand side of the `let`
+statement matches the pattern, the corresponding block will execute, otherwise
+flow proceeds to the first `else` block that follows.
 
 ```
 let dish = ("Ham", "Eggs");
@@ -3211,11 +3212,11 @@ if let ("Ham", b) = dish {
 
 ### `while let` loops
 
-A `while let` loop is semantically identical to a `while` loop but in place of a
-condition expression it expects a refutable let statement. If the value of the
-expression on the right hand side of the let statement matches the pattern, the
-loop body block executes and control returns to the pattern matching statement.
-Otherwise, the while expression completes.
+A `while let` loop is semantically identical to a `while` loop but in place of
+a condition expression it expects `let` statement with a refutable pattern. If
+the value of the expression on the right hand side of the `let` statement
+matches the pattern, the loop body block executes and control returns to the
+pattern matching statement. Otherwise, the while expression completes.
 
 ### `return` expressions