Exercise 8 · Chapter: VectorsOptional+50 XP
Reverse List
Create a vector with 1, 2, 3, 4, 5. Reverse it, then print each number on its own line.
Expected output:
5 4 3 2 1
Hints:
- Use
.reverse()to reverse a vector in place - Don't forget
mutsince.reverse()changes the vector!
rust
fn main() {
}
Output
Run your code to see the output here.