36 lines
540 B
Go
36 lines
540 B
Go
![]() |
package main
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
type Vertex struct {
|
||
|
Lat, Long float64
|
||
|
}
|
||
|
|
||
|
var m map[string]Vertex
|
||
|
var new_m = map[string]Vertex{
|
||
|
"Bell Labs": Vertex{
|
||
|
40.68433, -74.39967,
|
||
|
},
|
||
|
"Google": Vertex{
|
||
|
37.42202, -122.08408,
|
||
|
},
|
||
|
}
|
||
|
|
||
|
// The above can also be written
|
||
|
var new_new_m = map[string]Vertex{
|
||
|
"Bell Labs": {40.68433, -74.39967},
|
||
|
"Google": {37.42202, -122.08408},
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
m = make(map[string]Vertex)
|
||
|
m["Bell Labs"] = Vertex{
|
||
|
40.68433, -74.39967,
|
||
|
}
|
||
|
fmt.Println(m["Bell Labs"])
|
||
|
|
||
|
|
||
|
fmt.Println(new_m)
|
||
|
fmt.Println(new_new_m)
|
||
|
}
|