Merge pull request #281 from Skandesh/patch-4

Update Vector.md
This commit is contained in:
Sunface 2022-07-28 09:05:24 +08:00 committed by GitHub
commit 4528ec0721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 1 deletions

View File

@ -96,6 +96,25 @@ fn main() {
println!("Success!")
}
//Another solution
fn main() {
let mut v = Vec::from([1, 2, 3,4,5]);
for i in 0..5 {
println!("{:?}", v[i])
}
for i in 0..5 {
v[i] +=1;
}
assert_eq!(v, vec![2, 3, 4, 5, 6]);
println!("Success!")
}
```
5.
@ -215,4 +234,4 @@ fn main() {
ip.display();
}
}
```
```