mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-12-28 06:49:19 +00:00
Merge 22d13d9dca25b25cc34742e175cea1a9848a7db9 into 7850a73d95c02840f4ab3bf8d9571b08410e5467
This commit is contained in:
commit
8ef0d3fff8
@ -1,9 +1,13 @@
|
||||
fn array_and_vec() -> ([i32; 4], Vec<i32>) {
|
||||
let a = [10, 20, 30, 40]; // Array
|
||||
// You can define an array with the intitial values 10, 20, 30 and 40 like
|
||||
// this:
|
||||
let a = [10, 20, 30, 40]; // Array. Do not change!
|
||||
|
||||
// TODO: Create a vector called `v` which contains the exact same elements as in the array `a`.
|
||||
// Use the vector macro.
|
||||
// let v = ???;
|
||||
// There is a similar way you can define a vector with initial values:
|
||||
// let v = vec![10, 20, ???]; // Vector. Needs to be fixed
|
||||
|
||||
// TODO: Adjust the vector definition above so that `a` and `v` have the
|
||||
// same contents.
|
||||
|
||||
(a, v)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user