Skip to content

Commit

Permalink
Added an example of slicing result
Browse files Browse the repository at this point in the history
This should make it clearer how slicing works.
  • Loading branch information
Kixunil committed Mar 15, 2021
1 parent fc2f690 commit ca34e59
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ch04-03-slices.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ to part of an array. We’d do so like this:
let a = [1, 2, 3, 4, 5];

let slice = &a[1..3];

assert_eq!(slice, &[2, 3]);
```

This slice has the type `&[i32]`. It works the same way as string slices do, by
Expand Down

0 comments on commit ca34e59

Please sign in to comment.