Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
ff6a8fd7
Commit
ff6a8fd7
authored
Nov 20, 2009
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mention arrays of arrays and slices of slices
Fixes #113. R=gri, rsc CC=golang-dev
https://golang.org/cl/159049
parent
28e392d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
go_spec.html
doc/go_spec.html
+11
-0
No files found.
doc/go_spec.html
View file @
ff6a8fd7
...
...
@@ -607,12 +607,16 @@ integer value. The length of array <code>a</code> can be discovered
using the built-in function
<code>
len(a)
</code>
, which is a
compile-time constant. The elements can be indexed by integer
indices 0 through the
<code>
len(a)-1
</code>
(§
<a
href=
"#Indexes"
>
Indexes
</a>
).
Array types are always one-dimensional but may be composed to form
multi-dimensional types.
</p>
<pre>
[32]byte
[2*N] struct { x, y int32 }
[1000]*float64
[3][5]int
[2][2][2]float64 // same as [2]([2]([2]float64))
</pre>
<h3
id=
"Slice_types"
>
Slice types
</h3>
...
...
@@ -690,6 +694,13 @@ make([]int, 50, 100)
new([100]int)[0:50]
</pre>
<p>
Like arrays, slices are always one-dimensional but may be composed to construct
higher-dimensional objects.
With arrays of arrays, the inner arrays are, by construction, always the same length;
however with slices of slices (or arrays of slices), the lengths may vary dynamically.
Moreover, the inner slices must be allocated individually (with
<code>
make
</code>
).
</p>
<h3
id=
"Struct_types"
>
Struct types
</h3>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment