mirror of
https://github.com/golang/go
synced 2024-11-22 01:34:41 -07:00
redo poor example of slices.
R=rsc OCL=25614 CL=25614
This commit is contained in:
parent
da38974c88
commit
da34bea950
@ -1014,11 +1014,13 @@ make([]T, length, capacity)
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
produces the same slice as allocating an array and slicing it:
|
produces the same slice as allocating an array and slicing it, so these two examples
|
||||||
|
produce the same slice:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
make([]T, capacity)[0 : length]
|
make([]int, 50, 100)
|
||||||
|
new([100]int)[0:50]
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user