Go Arrays: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 14: | Line 14: | ||
A declaration without explicit initialization initializes the array with the [[Go Concepts - The Type System#Zero_Value|type's zero value]]. | A declaration without explicit initialization initializes the array with the [[Go Concepts - The Type System#Zero_Value|type's zero value]]. | ||
Type inference and initialization declaration: | |||
<pre> | |||
a := [5]int{1, 2, 3, 4, 5} | |||
</pre> | |||
=Array Literals= | =Array Literals= |
Revision as of 22:59, 27 March 2016
Internal
Overview
An array is a numbered sequence of elements, of a single type, and with a fixed length.
Declaration
var a [5]int
A declaration without explicit initialization initializes the array with the type's zero value.
Type inference and initialization declaration:
a := [5]int{1, 2, 3, 4, 5}
Array Literals
Array Operators and Functions
Indexing Operator
Indexing operator [] returns the value at that position.