mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 19:46:23 +00:00
26 lines
464 B
Markdown
26 lines
464 B
Markdown
|
---
|
||
|
id: 24d46884-652c-4b64-b8e1-1baf81bea0f4
|
||
|
title: Golang Arrays
|
||
|
---
|
||
|
|
||
|
Arrays are a thing in Go as well. Once initialized arrays cannot be
|
||
|
resized, if you're into **that** type of thing (no judgement) see
|
||
|
[slices](20200828182546-slices)
|
||
|
|
||
|
``` go
|
||
|
package main
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
func main() {
|
||
|
var a [2]string
|
||
|
a[0] = "Hello"
|
||
|
a[1] = "World"
|
||
|
fmt.Println(a[0], a[1])
|
||
|
fmt.Println(a)
|
||
|
|
||
|
primes := [6]int{2, 3, 5, 7, 11, 13}
|
||
|
fmt.Println(primes)
|
||
|
}
|
||
|
```
|