You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following paragraph of Chapter 19.1 describes an attempt to safely implement a mutable slice split function:
This function first gets the total length of the slice. Then it asserts that the index given as a parameter is within the slice by checking whether it’s less than or equal to the length. The assertion means that if we pass an index that is greater than the index to split the slice at, the function will panic before it attempts to use that index.
It looks like this should not say "if we pass an index that is greater than the index", but rather "if we pass an index that is greater than the length", as the comparison is between the index and the length, not two indices.
The text was updated successfully, but these errors were encountered:
Zoybean
added a commit
to Zoybean/book
that referenced
this issue
Jun 18, 2019
The following paragraph of Chapter 19.1 describes an attempt to safely implement a mutable slice split function:
It looks like this should not say "if we pass an index that is greater than the index", but rather "if we pass an index that is greater than the length", as the comparison is between the index and the length, not two indices.
The text was updated successfully, but these errors were encountered: