diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-09-09 07:39:14 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-09-09 12:07:14 -0700 |
| commit | 456f00eb7e7d729da033c6fe20054e48b38ad05f (patch) | |
| tree | b8dac5761dabfe847acbf926e8319910989e0f84 | |
| parent | 613ae0b4862f162b0aaacd8b5d0f4392f6261b86 (diff) | |
| parent | 18f1f5a06eb772a5772a728a97b4056d821e7e56 (diff) | |
| download | rust-456f00eb7e7d729da033c6fe20054e48b38ad05f.tar.gz rust-456f00eb7e7d729da033c6fe20054e48b38ad05f.zip | |
rollup merge of #17107 : steveklabnik/uninitialized_bindings
| -rw-r--r-- | src/doc/guide.md | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/doc/guide.md b/src/doc/guide.md index e4bb3ae6ba6..6d0fd54cd4c 100644 --- a/src/doc/guide.md +++ b/src/doc/guide.md @@ -520,10 +520,8 @@ error: aborting due to previous error Could not compile `hello_world`. ``` -Rust will not let us use a value that has not been initialized. So why let us -declare a binding without initializing it? You'd think our first example would -have errored. Well, Rust is smarter than that. Before we get to that, let's talk -about this stuff we've added to `println!`. +Rust will not let us use a value that has not been initialized. Next, let's +talk about this stuff we've added to `println!`. If you include two curly braces (`{}`, some call them moustaches...) in your string to print, Rust will interpret this as a request to interpolate some sort @@ -538,12 +536,6 @@ format in a more detailed manner, there are a [wide number of options available](std/fmt/index.html). For now, we'll just stick to the default: integers aren't very complicated to print. -So, we've cleared up all of the confusion around bindings, with one exception: -why does Rust let us declare a variable binding without an initial value if we -must initialize the binding before we use it? And how does it know that we have -or have not initialized the binding? For that, we need to learn our next -concept: `if`. - # If Rust's take on `if` is not particularly complex, but it's much more like the @@ -582,7 +574,6 @@ if x == 5i { This is all pretty standard. However, you can also do this: - ``` let x = 5i; |
