Fixed slice() returning empty string when referring to last character (#751)

* Fixed slice() returning empty string when referring to last character
This commit is contained in:
replaceitem authored and GitHub committed 2021-03-01 22:10:49 -04:00
1 parent aa372f5480
commit ca4db433c1
3 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -187,10 +187,10 @@ other parts. In that case consecutive calls to `slice` will refer to index `0` t
cannot go back nor track where they are in the sequence (see examples).
<pre>
slice([0,1,2,3,4,5], 1, 3) => [1, 2, 3]
slice([0,1,2,3,4,5], 1, 3) => [1, 2]
slice('foobar', 0, 1) => 'f'
slice('foobar', 3) => 'bar'
slice(range(10), 3, 5) => [3, 4, 5]
slice(range(10), 3, 5) => [3, 4]
slice(range(10), 5) => [5, 6, 7, 8, 9]
r = range(100); [slice(r, 5, 7), slice(r, 1, 3)] => [[5, 6], [8, 9]]
</pre>