Go — Arrays (basics)
In GO arrays are always the same length, as they are defined. Here is an example of an initialization of an array of length 5 containing all zeroes, in GO:
We can then access or set new values for each of the “spots” in the array:
The previously mentioned length of an array can also be found by the function: “len”:
When initializing a new array, we can also put in the values we want on each place in the array, called initialization and declaration:
More often than not you will usually see “slices” in GO, than arrays.
For Slices see my next article, which will describe the differences between arrays and slices in GO.