mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-07 11:19:18 +00:00
fix(vecs1): added 3rd option in hint
This commit is contained in:
parent
8d0aa11a35
commit
1d0eaf0d2a
@ -283,11 +283,12 @@ name = "vecs1"
|
|||||||
path = "exercises/05_vecs/vecs1.rs"
|
path = "exercises/05_vecs/vecs1.rs"
|
||||||
mode = "test"
|
mode = "test"
|
||||||
hint = """
|
hint = """
|
||||||
In Rust, there are two ways to define a Vector.
|
In Rust, there are three ways to define a Vector.
|
||||||
1. One way is to use the `Vec::new()` function to create a new vector
|
1. One way is to use the `Vec::new()` function to create a new vector
|
||||||
and fill it with the `push()` method.
|
and fill it with the `push()` method.
|
||||||
2. The second way, which is simpler is to use the `vec![]` macro and
|
2. The second way, which is simpler is to use the `vec![]` macro and
|
||||||
define your elements inside the square brackets.
|
define your elements inside the square brackets.
|
||||||
|
3. Additionally, one can use `Vec::from()`, as in `Vec::from(a)`
|
||||||
|
|
||||||
Check this chapter: https://doc.rust-lang.org/stable/book/ch08-01-vectors.html
|
Check this chapter: https://doc.rust-lang.org/stable/book/ch08-01-vectors.html
|
||||||
of the Rust book to learn more.
|
of the Rust book to learn more.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user