File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -268,15 +268,14 @@ name = "vecs2"
268
268
path = " exercises/vecs/vecs2.rs"
269
269
mode = " test"
270
270
hint = """
271
- Hint 1: In the code, the variable `element` represents an item from the Vec as it is being iterated.
272
- Can you try multiplying this?
271
+ In the first function we are looping over the Vector and getting a reference to one `element` at a time.
272
+ To modify the value of that `element` we need to use the * dereference operator. You can learn more in this chapter of the Rust book:
273
+ https://doc.rust-lang.org/stable/book/ch08-01-vectors.html#iterating-over-the-values-in-a-vector
273
274
274
- Hint 2: For the first function, there's a way to directly access the numbers stored
275
- in the Vec, using the * dereference operator. You can both access and write to the
276
- number that way.
275
+ In the second function this dereferencing is not necessary, because the map function expects the new value to be returned.
277
276
278
- After you've completed both functions, decide for yourself which approach you like
279
- better. What do you think is the more commonly used pattern under Rust developers?
277
+ After you've completed both functions, decide for yourself which approach you like better.
278
+ What do you think is the more commonly used pattern under Rust developers?
280
279
"""
281
280
282
281
# MOVE SEMANTICS
You can’t perform that action at this time.
0 commit comments