From 6e192269296d58d586d00abbc7733e52292290e8 Mon Sep 17 00:00:00 2001 From: Kishan B Date: Sat, 5 Oct 2019 16:53:48 +0530 Subject: [PATCH] Explicit mention of slice range meaning In `&ys[1 .. 4]` i did not understand whether 4 meant the length or the end index. This is to prevent other readers from having the same confusion. --- src/primitives/array.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/primitives/array.md b/src/primitives/array.md index fe4bee94c2..f612c1dbc2 100644 --- a/src/primitives/array.md +++ b/src/primitives/array.md @@ -42,6 +42,9 @@ fn main() { analyze_slice(&xs); // Slices can point to a section of an array + // They are of the form [starting_index..ending_index] + // starting_index is the first position in the slice + // ending_index is one more than the last position in the slice println!("borrow a section of the array as a slice"); analyze_slice(&ys[1 .. 4]);