Skip to content

Commit 3211811

Browse files
Add +1 to next_age
While the example as it is correctly demonstrates the use of the `?` operator, I feel adding 1 to `next_age` makes it more consistent with the variable name (unless I am missing something?)
1 parent cb578b1 commit 3211811

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/error/option_unwrap/question_mark.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function is being executed and return `None`.
99
fn next_birthday(current_age: Option<u8>) -> Option<String> {
1010
// If `current_age` is `None`, this returns `None`.
1111
// If `current_age` is `Some`, the inner `u8` gets assigned to `next_age`
12-
let next_age: u8 = current_age?;
12+
let next_age: u8 = current_age? + 1;
1313
Some(format!("Next year I will be {}", next_age))
1414
}
1515
```

0 commit comments

Comments
 (0)