File tree 1 file changed +11
-0
lines changed 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -607,12 +607,16 @@ <h3 id="Array_types">Array types</h3>
607
607
using the built-in function < code > len(a)</ code > , which is a
608
608
compile-time constant. The elements can be indexed by integer
609
609
indices 0 through the < code > len(a)-1</ code > (§< a href ="#Indexes "> Indexes</ a > ).
610
+ Array types are always one-dimensional but may be composed to form
611
+ multi-dimensional types.
610
612
</ p >
611
613
612
614
< pre >
613
615
[32]byte
614
616
[2*N] struct { x, y int32 }
615
617
[1000]*float64
618
+ [3][5]int
619
+ [2][2][2]float64 // same as [2]([2]([2]float64))
616
620
</ pre >
617
621
618
622
< h3 id ="Slice_types "> Slice types</ h3 >
@@ -690,6 +694,13 @@ <h3 id="Slice_types">Slice types</h3>
690
694
new([100]int)[0:50]
691
695
</ pre >
692
696
697
+ < p >
698
+ Like arrays, slices are always one-dimensional but may be composed to construct
699
+ higher-dimensional objects.
700
+ With arrays of arrays, the inner arrays are, by construction, always the same length;
701
+ however with slices of slices (or arrays of slices), the lengths may vary dynamically.
702
+ Moreover, the inner slices must be allocated individually (with < code > make</ code > ).
703
+ </ p >
693
704
694
705
< h3 id ="Struct_types "> Struct types</ h3 >
695
706
You can’t perform that action at this time.
0 commit comments