๋ฐ์ํ
์ต์์ ํ์ ์ด ํ์ ์ด๋ฆ์ผ ๊ฒฝ์ฐ, ๋ฆฌํฐ๋ด์ ์์์์ ์๋ตํ ์ ์๋ค.
- ๋ฆฌํฐ๋ด์ด ์๋ต๋์ง ์์ ๊ฒฝ์ฐ
type Vertex struct {
Lat, Long float64
}
// ๋ฆฌํฐ๋ด์ด ์๋ต๋์ง ์์ ๊ฒฝ์ฐ
var m = map[string]Vertex{
"Bell Labs": Vertex{
40.68433, -74.39967,
},
"Google": Vertex{
37.42202, -122.08408,
},
}
func main() {
fmt.Println(m)
}
- ๋ฆฌํฐ๋ด์ด ์๋ต๋ ๊ฒฝ์ฐ
type Vertex struct {
Lat, Long float64
}
// ๋ฆฌํฐ๋ด์ด ์๋ต๋ ๊ฒฝ์ฐ
var m = map[string]Vertex{
"Bell Labs": {40.68433, -74.39967},
"Google": {37.42202, -122.08408},
}
func main() {
fmt.Println(m)
}
๋ฐ์ํ
'Data Base > Go' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Go failing - expected 'package', found 'EOF' (2) | 2021.11.10 |
---|---|
[Golang] Maps (0) | 2021.11.02 |
[Golang] range (0) | 2021.11.02 |
[์ฝ๊ณ ๋น ๋ฅธ Go ์์ํ๊ธฐ] #2.2 Methods part Two (0) | 2021.11.02 |
[์ฝ๊ณ ๋น ๋ฅธ Go ์์ํ๊ธฐ] #2.1 Methods part One (0) | 2021.11.02 |
๋๊ธ