diff options
| author | anand <anand.panchdhari@gmail.com> | 2025-11-19 14:35:50 +0530 |
|---|---|---|
| committer | anand <anand.panchdhari@gmail.com> | 2025-11-19 14:35:50 +0530 |
| commit | f8d94cce2a21067d666f65d23d591f0f40cf6c36 (patch) | |
| tree | 773c005674c1b21e3ef68a39feabb87aa2eaa305 /exercises/05_vecs/vecs2.rs | |
| parent | 8597b29e143cdeae50eafae06e0d8ed900b25295 (diff) | |
Finished vecs and move semantics
Diffstat (limited to 'exercises/05_vecs/vecs2.rs')
| -rw-r--r-- | exercises/05_vecs/vecs2.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/exercises/05_vecs/vecs2.rs b/exercises/05_vecs/vecs2.rs index 0c99626..636f0a7 100644 --- a/exercises/05_vecs/vecs2.rs +++ b/exercises/05_vecs/vecs2.rs @@ -1,9 +1,10 @@ fn vec_loop(input: &[i32]) -> Vec<i32> { let mut output = Vec::new(); - for element in input { + for element in input.iter() { // TODO: Multiply each element in the `input` slice by 2 and push it to // the `output` vector. + output.push(element * 2); } output |
