From ca34e5965a37860f225b58541fd10a29e600d4ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Habov=C5=A1tiak?= Date: Mon, 15 Mar 2021 18:19:39 +0100 Subject: [PATCH] Added an example of slicing result This should make it clearer how slicing works. --- src/ch04-03-slices.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ch04-03-slices.md b/src/ch04-03-slices.md index 2b0385278f..a6008f4b3a 100644 --- a/src/ch04-03-slices.md +++ b/src/ch04-03-slices.md @@ -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