From a351636bfa48c2e95659790fb0ca66c1beaad63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Bethune?= Date: Wed, 1 Jan 2025 17:46:38 +0100 Subject: [PATCH] A clearer description of the original problem The original excercise instructs the learner to use the vector macro. It is easy to assume that the code needs to read from `a` which is not what is intended. The updated excercise introduces the syntax for initial array and vector contents and lets the learner figure out how to tweak initial values of a vector. This learning seems to be the original intent of the excercise. --- exercises/05_vecs/vecs1.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/exercises/05_vecs/vecs1.rs b/exercises/05_vecs/vecs1.rs index 68e1affaa7..3b5f7bdcda 100644 --- a/exercises/05_vecs/vecs1.rs +++ b/exercises/05_vecs/vecs1.rs @@ -1,9 +1,13 @@ fn array_and_vec() -> ([i32; 4], Vec) { - let a = [10, 20, 30, 40]; // Array + // You can define an array with the intitial values 10, 20, 30 and 40 like + // this: + let a = [10, 20, 30, 40]; // Array. Do not change! - // TODO: Create a vector called `v` which contains the exact same elements as in the array `a`. - // Use the vector macro. - // let v = ???; + // There is a similar way you can define a vector with initial values: + let v = vec![20, 30, 40]; // Vector. Needs to be fixed + + // TODO: Adjust the vector definition above so that `a` and `v` have the + // same contents. (a, v) }