mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 18:11:38 +00:00
Merge pull request #703 from jcbohin/go-en-confusing_array_initialization-#257
[go/en] Array initialization disambiguation - fixes #257
This commit is contained in:
commit
1fb4886020
@ -92,7 +92,8 @@ can include line breaks.` // Same string type.
|
|||||||
|
|
||||||
// Arrays have size fixed at compile time.
|
// Arrays have size fixed at compile time.
|
||||||
var a4 [4]int // An array of 4 ints, initialized to all 0.
|
var a4 [4]int // An array of 4 ints, initialized to all 0.
|
||||||
a3 := [...]int{3, 1, 5} // An array of 3 ints, initialized as shown.
|
a3 := [...]int{3, 1, 5} // An array initialzed with a fixed size of three
|
||||||
|
// elements, with values 3, 1, and 5.
|
||||||
|
|
||||||
// Slices have dynamic size. Arrays and slices each have advantages
|
// Slices have dynamic size. Arrays and slices each have advantages
|
||||||
// but use cases for slices are much more common.
|
// but use cases for slices are much more common.
|
||||||
|
Loading…
Reference in New Issue
Block a user