-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.go
More file actions
29 lines (22 loc) · 668 Bytes
/
array.go
File metadata and controls
29 lines (22 loc) · 668 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
func main() {
// typing "a4" like array of four position
// var a4 [4]int
// s3 := []int{4, 5, 9}
// [...] used for array literal -> Use this syntax to declare and initialize an array in one line.
// a4 := [...]int{45, 23, 2, 1}
// declara a tipagem mas não inicializa
// var s3 [][]float64
// fmt.Println(s3)
// show length of array
// fmt.Println("len:", len(a4))
// Array types are one-dimensional, but you can compose types to build multi-dimensional data structures.
// var twoD [2][3]int
// for i := 0; i < 2; i++ {
// for j := 0; j < 3; j++ {
// twoD[i][j] = i + j
// }
// }
// fmt.Println(twoD)
// fmt.Println(a4)
}