Last active
June 22, 2016 20:34
-
-
Save ravlio/2d56975c7da71a180e930ac9ac352366 to your computer and use it in GitHub Desktop.
declarations and assignments of slices and maps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
var a []int | |
var b []int = []int{1, 2, 3} | |
var c map[string]int | |
var d map[string]*int = map[string]*int{"test":new(int)} | |
var e [4]int | |
var f map[string]int = map[string]int{} | |
var g map[string]int = make(map[string]int) | |
func main() { | |
f["test"] = 1 | |
g["t"] = 1 | |
fmt.Printf("%v,%v,%v,%v,%v,%v,%v", a, b, c, d, e, f, g) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment