Closed
Description
In the Arrays, Vectors, and Slices section the last example warns about the slice syntax.
let a = [0, 1, 2, 3, 4];
let middle = a.slice(1, 4); // A slice of a: just the elements [1,2,3]
This fixes it however I am not sure as to why the &
is needed?
let a = [0, 1, 2, 3, 4];
let middle = &a[1..4]; // A slice of a: just the elements [1,2,3]
I would submit a PR but I think some explanation is required and I am not the best person to be explaining this. (Just started looking into rust now that its in v1 alpha)
Metadata
Metadata
Assignees
Labels
No labels