mirror of
https://git.aramjonghu.dev/AramJonghu/rustlings.git
synced 2026-09-06 10:03:30 +02:00
Progress: finished primitive types, vecs, movesematics. progress structs
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
fn elems_to_vec(a: i32, b: i32, c: i32) -> Vec<i32> {
|
||||
// TODO: Return a vector containing the elements a, b and c (in this order).
|
||||
// Use the "vec!" macro.
|
||||
let vector: Vec<i32> = vec![a, b, c];
|
||||
vector
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
||||
@@ -4,6 +4,8 @@ fn vec_loop(input: &[i32]) -> Vec<i32> {
|
||||
for element in input {
|
||||
// TODO: Multiply each element in the `input` slice by 2 and push it to
|
||||
// the `output` vector.
|
||||
|
||||
output.push(element * 2);
|
||||
}
|
||||
|
||||
output
|
||||
|
||||
Reference in New Issue
Block a user