diff --git a/doc/go_spec.html b/doc/go_spec.html index 285c867d5f7..fb7b68c9cc9 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -2183,7 +2183,7 @@ PrimaryExpr = Selector = "." identifier . Index = "[" Expression "]" . -Slice = "[" Expression ":" [ Expression ] "]" . +Slice = "[" [ Expression ] ":" [ Expression ] "]" . TypeAssertion = "." "(" Type ")" . Call = "(" [ ExpressionList [ "," ] ] ")" . @@ -2453,12 +2453,15 @@ s[2] == 4
-For convenience, the hi
expression may be omitted; the notation
-a[lo :]
is shorthand for a[lo : len(a)]
.
-For arrays or strings, the indexes
-lo
and hi
must satisfy
-0 <= lo
<= hi
<= length;
-for slices, the upper bound is the capacity rather than the length.
+For convenience, any of the index expressions may be omitted. A missing low
+index defaults to zero; a missing high index defaults to the length of the
+array, slice, or string.
+
+For arrays or strings, the indexes low
and high
must
+satisfy 0 <= low
<= high
<= length; for
+slices, the upper bound is the capacity rather than the length.