Skip to content

Commit 14fbdd2

Browse files
authored
Merge pull request #1473 from Jak-Ch-ll/update-hints-for-vecs2
docs(vecs2): update hints
2 parents a5fe578 + ad0fad4 commit 14fbdd2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

info.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,14 @@ name = "vecs2"
268268
path = "exercises/vecs/vecs2.rs"
269269
mode = "test"
270270
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
273274
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.
277276
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?
280279
"""
281280

282281
# MOVE SEMANTICS

0 commit comments

Comments
 (0)