Skip to content

Commit 8cb5cba

Browse files
committed
docs(vecs2): update hints
1 parent 9fc336c commit 8cb5cba

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
@@ -260,15 +260,14 @@ name = "vecs2"
260260
path = "exercises/vecs/vecs2.rs"
261261
mode = "test"
262262
hint = """
263-
Hint 1: `i` is each element from the Vec as they are being iterated. Can you try
264-
multiplying this?
263+
In the first function we are looping over the Vector and getting a reference to one `element` at a time.
264+
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:
265+
https://doc.rust-lang.org/stable/book/ch08-01-vectors.html#iterating-over-the-values-in-a-vector
265266
266-
Hint 2: For the first function, there's a way to directly access the numbers stored
267-
in the Vec, using the * dereference operator. You can both access and write to the
268-
number that way.
267+
In the second function this dereferencing is not necessary, because the map function expects the new value to be returned.
269268
270-
After you've completed both functions, decide for yourself which approach you like
271-
better. What do you think is the more commonly used pattern under Rust developers?
269+
After you've completed both functions, decide for yourself which approach you like better.
270+
What do you think is the more commonly used pattern under Rust developers?
272271
"""
273272

274273
# MOVE SEMANTICS

0 commit comments

Comments
 (0)