mirror of
https://github.com/rust-lang/book.git
synced 2026-05-17 14:21:44 -04:00
Extra-clarity qualification
Regard the preceding wording “we’ve annotated the types of the values that are returned from these functions for extra clarity.” while only the indexing function is annotated.
This commit is contained in:
committed by
Carol (Nichols || Goulding)
parent
96d4b0ec1c
commit
eedc18924d
@@ -5,7 +5,8 @@ fn main() {
|
||||
let third: &i32 = &v[2];
|
||||
println!("The third element is {}", third);
|
||||
|
||||
match v.get(2) {
|
||||
let third: Option<&i32> = v.get(2);
|
||||
match third {
|
||||
Some(third) => println!("The third element is {}", third),
|
||||
None => println!("There is no third element."),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user