開発環境
- 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 1(let's get going - Syntax Basics)、Pool Puzzle(10)の解答を求めてみる。
コード
package main
import (
"fmt"
)
func main() {
var originalCount int = 10
var eatenCount int = 4
fmt.Println("I started with", originalCount, "apple.")
fmt.Println("Some jerk ate", eatenCount, "apples.")
fmt.Println("There are", originalCount-eatenCount, "apples left.")
}
入出力結果(cmd(コマンドプロンプト)、Terminal)
C:\Users\...>go run sample2.go I started with 10 apple. Some jerk ate 4 apples. There are 6 apples left. C:\Users\...>
0 コメント:
コメントを投稿