開発環境
- macOS Mojave - Apple (OS)
- Emacs (Text Editor)
- Windows 10 Pro (OS)
- Visual Studio Code (Text Editor)
- Go (プログラミング言語)
Head First Go (Jay McGavren(著)、O'Reilly Media)のChapter 8(building storage - Structs)、Pool Puzzle(252)の解答を求めてみる。
コード
~/go/src/heafirstgo/geo/geo.go
package geo
type Coordinates struct {
Latitude float64
Longitutde float64
}
main.go
package main
import (
"fmt"
"heafirstgo/geo"
)
func main() {
location := geo.Coordinates{Latitude: 37.24, Longitutde: -122.08}
fmt.Println("Latitude:", location.Latitude)
fmt.Println("Longitutde:", location.Longitutde)
}
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal)
$ go run main.go Latitude: 37.24 Longitutde: -122.08 $
0 コメント:
コメントを投稿