mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-10 23:06:23 +00:00
commit
c6a9877039
@ -82,7 +82,7 @@ arrays:
|
||||
|
||||
```{rust}
|
||||
let a = [0, 1, 2, 3, 4];
|
||||
let middle = a.slice(1, 4); // A slice of a: just the elements [1,2,3]
|
||||
let middle = &a[1..4]; // A slice of a: just the elements 1, 2, and 3
|
||||
|
||||
for e in middle.iter() {
|
||||
println!("{}", e); // Prints 1, 2, 3
|
||||
|
Loading…
Reference in New Issue
Block a user