mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-10 12:49:18 +00:00
fixed the variable name to make vecs multiplied by 2
This commit is contained in:
parent
8ef0d03cf1
commit
d47d23ee86
@ -18,7 +18,7 @@
|
||||
// - The output element is going to be a Vector of strings.
|
||||
// Execute `rustlings hint quiz2` or use the `hint` watch subcommand for a hint.
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
|
||||
pub enum Command {
|
||||
Uppercase,
|
||||
|
||||
@ -12,7 +12,7 @@ fn vec_loop(mut v: Vec<i32>) -> Vec<i32> {
|
||||
for element in v.iter_mut() {
|
||||
// TODO: Fill this up so that each element in the Vec `v` is
|
||||
// multiplied by 2.
|
||||
*i *= 2;
|
||||
*element *= 2;
|
||||
}
|
||||
|
||||
// At this point, `v` should be equal to [4, 8, 12, 16, 20].
|
||||
@ -20,7 +20,7 @@ fn vec_loop(mut v: Vec<i32>) -> Vec<i32> {
|
||||
}
|
||||
|
||||
fn vec_map(v: &Vec<i32>) -> Vec<i32> {
|
||||
v.iter().map(|element| {
|
||||
v.iter().map(|&num| {
|
||||
// TODO: Do the same thing as above - but instead of mutating the
|
||||
// Vec, you can just return the new number!
|
||||
num * 2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user