easy docs

This commit is contained in:
Mark McGranaghan 2012-09-21 07:57:50 -07:00
parent 354a9d862f
commit 5d217ce5c1
3 changed files with 19 additions and 5 deletions

View File

@ -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.
*/

View File

@ -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
*/

View File

@ -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?