docs(vecs2): update hints
This commit is contained in:
parent
9fc336c7f7
commit
8cb5cba775
13
info.toml
13
info.toml
|
@ -260,15 +260,14 @@ name = "vecs2"
|
||||||
path = "exercises/vecs/vecs2.rs"
|
path = "exercises/vecs/vecs2.rs"
|
||||||
mode = "test"
|
mode = "test"
|
||||||
hint = """
|
hint = """
|
||||||
Hint 1: `i` is each element from the Vec as they are being iterated. Can you try
|
In the first function we are looping over the Vector and getting a reference to one `element` at a time.
|
||||||
multiplying this?
|
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:
|
||||||
|
https://doc.rust-lang.org/stable/book/ch08-01-vectors.html#iterating-over-the-values-in-a-vector
|
||||||
|
|
||||||
Hint 2: For the first function, there's a way to directly access the numbers stored
|
In the second function this dereferencing is not necessary, because the map function expects the new value to be returned.
|
||||||
in the Vec, using the * dereference operator. You can both access and write to the
|
|
||||||
number that way.
|
|
||||||
|
|
||||||
After you've completed both functions, decide for yourself which approach you like
|
After you've completed both functions, decide for yourself which approach you like better.
|
||||||
better. What do you think is the more commonly used pattern under Rust developers?
|
What do you think is the more commonly used pattern under Rust developers?
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# MOVE SEMANTICS
|
# MOVE SEMANTICS
|
||||||
|
|
Loading…
Reference in a new issue