Skip to content

Instantly share code, notes, and snippets.

@jeffotoni
Last active June 19, 2021 13:23
Show Gist options
  • Save jeffotoni/9cd1a3832e788482b1b91eff3bd7a70d to your computer and use it in GitHub Desktop.
Save jeffotoni/9cd1a3832e788482b1b91eff3bd7a70d to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
func main() {
var i interface{}
i = "Go Engineering 2.0"
i = 2021
i = 10.55
r := i.(float64)
fmt.Println(r)
var i2 []interface{}
i2 = append(i2, "Go v2")
i2 = append(i2, 2022)
i2 = append(i2, 23.44)
i = map[int]string{
0: "GO",
1: "C",
}
i2 = append(i2, i)
for _, x := range i2 {
fmt.Println(x)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment