Clarified collection in slice definition

Noticed the slice definition in the first paragraph relies on the reader recalling:
* what collections are
* that the reference page ended stating slices are a kind of reference

I think the first paragraph should be more clear to someone who lands on it and isn't reading the rest of the documentation ATM.
This commit is contained in:
Amit Weisbord 2022-09-27 10:14:41 +03:00 committed by GitHub
parent f1e5ad844d
commit 7b109240d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -1,8 +1,9 @@
## The Slice Type
*Slices* let you reference a contiguous sequence of elements in a collection
rather than the whole collection. A slice is a kind of reference, so it does
not have ownership.
*Slices* are a kind of reference, which lets you access a contiguous sub-sequence
of elements in a sequential [collection](book/src/ch08-00-common-collections.md).
Because slices are a kind of reference, they too can borrow access to memory, but
not own it.
Heres a small programming problem: write a function that takes a string of
words separated by spaces and returns the first word it finds in that string.