Skip to content

Commit 3db9bee

Browse files
committed
Auto merge of #30059 - androm3da:master, r=bluss
2 parents 323781c + 797a0bd commit 3db9bee

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/doc/book/if-let.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ if let Some(x) = option {
5858
## `while let`
5959

6060
In a similar fashion, `while let` can be used when you want to conditionally
61-
loop as long as a value matches a certain pattern. It turns code like this:
61+
loop as long as a value matches a certain pattern. It turns code like this:
6262

6363
```rust
64-
# let option: Option<i32> = None;
64+
let mut v = vec![1, 3, 5, 7, 11];
6565
loop {
66-
match option {
67-
Some(x) => println!("{}", x),
66+
match v.pop() {
67+
Some(x) => println!("{}", x),
6868
None => break,
6969
}
7070
}
@@ -73,8 +73,8 @@ loop {
7373
Into code like this:
7474

7575
```rust
76-
# let option: Option<i32> = None;
77-
while let Some(x) = option {
76+
let mut v = vec![1, 3, 5, 7, 11];
77+
while let Some(x) = v.pop() {
7878
println!("{}", x);
7979
}
8080
```

0 commit comments

Comments
 (0)