diff --git a/README.md b/README.md index c1e854d..4e94545 100644 --- a/README.md +++ b/README.md @@ -1644,8 +1644,8 @@ Recursion works in Rust too, so this sort of function does work: ```rust fn print_vec(mut input: Vec) { - if !input.is_empty() { // note the ! - println!("{}", input.pop().unwrap()); + if let Some(last) = input.pop() { + println!("{}", last); print_vec(input); // calling the same function } else { println!("All done!");