mirror of https://github.com/rust-lang/rustlings
feat: move vec exercises into their own folder
parent
8e1f617d34
commit
2f7fd51304
@ -0,0 +1,15 @@
|
|||||||
|
# Vectors
|
||||||
|
|
||||||
|
Vectors are one of the most-used Rust data structures. In other programming
|
||||||
|
languages, they'd simply be called Arrays, but since Rust operates on a
|
||||||
|
bit of a lower level, an array in Rust is stored on the stack (meaning it
|
||||||
|
can't grow or shrink, and the size needs to be known at compile time),
|
||||||
|
and a Vector is stored in the heap (where these restrictions do not apply).
|
||||||
|
|
||||||
|
Vectors are a bit of a later chapter in the book, but we think that they're
|
||||||
|
useful enough to talk about them a bit earlier. We shall be talking about
|
||||||
|
the other useful data structure, hash maps, later.
|
||||||
|
|
||||||
|
## Further information
|
||||||
|
|
||||||
|
- [Storing Lists of Values with Vectors](https://doc.rust-lang.org/stable/book/ch08-01-vectors.html)
|
@ -1,8 +1,8 @@
|
|||||||
// vec1.rs
|
// vecs1.rs
|
||||||
// Your task is to create a `Vec` which holds the exact same elements
|
// Your task is to create a `Vec` which holds the exact same elements
|
||||||
// as in the array `a`.
|
// as in the array `a`.
|
||||||
// Make me compile and pass the test!
|
// Make me compile and pass the test!
|
||||||
// Execute `rustlings hint vec1` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint vecs1` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
// vec2.rs
|
// vecs2.rs
|
||||||
// A Vec of even numbers is given. Your task is to complete the loop
|
// A Vec of even numbers is given. Your task is to complete the loop
|
||||||
// so that each number in the Vec is multiplied by 2.
|
// so that each number in the Vec is multiplied by 2.
|
||||||
//
|
//
|
||||||
// Make me pass the test!
|
// Make me pass the test!
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint vec2` or use the `hint` watch subcommand for a hint.
|
// Execute `rustlings hint vecs2` or use the `hint` watch subcommand for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
Loading…
Reference in New Issue