From 5d217ce5c1ce72ad9713a5728ac2e6c516b7d4cc Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Fri, 21 Sep 2012 07:57:50 -0700 Subject: [PATCH] easy docs --- 001-hello-world.go | 6 +++--- 004-mutation.go | 8 +++++++- 005-literal.go | 10 +++++++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/001-hello-world.go b/001-hello-world.go index 925f0a6..0dd5b7d 100644 --- a/001-hello-world.go +++ b/001-hello-world.go @@ -6,7 +6,7 @@ func main() { fmt.Println("Hello world") // It prints `Hello world`. } -/* // Put this code in hello-world.go, then use -$ go run hello-world.go // `go run` to run it. -Hello world +/* +$ go run hello-world.go // Put this code in hello-world.go, +Hello world // then use `go run` to run it. */ diff --git a/004-mutation.go b/004-mutation.go index 7283a51..677c84c 100644 --- a/004-mutation.go +++ b/004-mutation.go @@ -6,6 +6,12 @@ func main() { var x string x = "first" fmt.Println(x) - x = "second" + x = "second" // You can mutate variables in Go. fmt.Println(x) } + +/* +$ go run mutation.go +first +second +*/ diff --git a/005-literal.go b/005-literal.go index 21e7a50..87a8192 100644 --- a/005-literal.go +++ b/005-literal.go @@ -3,6 +3,14 @@ package main import "fmt" func main() { - x := "Hello World" + x := "Hello literal" // `x := val` is shorthand for `var x type = val`. fmt.Println(x) } + +/* +$ go run literal.go +Hello literal +*/ + +// == todo +// literal?