Go TutorialLesson 10Free preview
Go Arrays
This lesson is part of Go · All levels
Summary
This lesson discusses an array in Go, which is a set of elements with the same type and fixed length as defined in the declaration. The array index starts from 0 and its length can be checked with the len() function. Go copies the array as it is assigned to another variable, so changes to the copy do not affect the original.
Key points
- The length of the array must be determined at the time of declaration and cannot be changed
- The index of elements ranges from 0 to length 1
- Returns the number of array elements
- The array is of a value type, so the assignment produces a copy.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.