Merge pull request #1418 from adamhb123/vecs2.rs-naming-suggestion

Rename iteration var names in vec2.rs for clarity
This commit is contained in:
liv 2023-03-14 11:15:07 +01:00 committed by GitHub
commit a55c8dc1a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@
// I AM NOT DONE // I AM NOT DONE
fn vec_loop(mut v: Vec<i32>) -> Vec<i32> { fn vec_loop(mut v: Vec<i32>) -> Vec<i32> {
for i in v.iter_mut() { for element in v.iter_mut() {
// TODO: Fill this up so that each element in the Vec `v` is // TODO: Fill this up so that each element in the Vec `v` is
// multiplied by 2. // multiplied by 2.
??? ???
@ -20,7 +20,7 @@ fn vec_loop(mut v: Vec<i32>) -> Vec<i32> {
} }
fn vec_map(v: &Vec<i32>) -> Vec<i32> { fn vec_map(v: &Vec<i32>) -> Vec<i32> {
v.iter().map(|num| { v.iter().map(|element| {
// TODO: Do the same thing as above - but instead of mutating the // TODO: Do the same thing as above - but instead of mutating the
// Vec, you can just return the new number! // Vec, you can just return the new number!
??? ???