1
0
Fork 0
This commit is contained in:
Alex Kotov 2020-11-17 08:41:30 +05:00
parent f95cd273d3
commit 0c63b698be
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 26 additions and 0 deletions

2
3-map-in-go/Makefile Normal file
View file

@ -0,0 +1,2 @@
all:
go run main.go

24
3-map-in-go/main.go Normal file
View file

@ -0,0 +1,24 @@
package main
import (
"fmt"
)
func main() {
var a [10]int
for i := range a {
a[i] = i
}
var b [10]struct{n int; nn int}
for i, n := range a {
b[i].n = n
b[i].nn = n * n
}
for _, v := range b {
fmt.Printf("%v: %v\n", v.n, v.nn)
}
}