easy docs
This commit is contained in:
parent
354a9d862f
commit
5d217ce5c1
@ -6,7 +6,7 @@ func main() {
|
|||||||
fmt.Println("Hello world") // It prints `Hello world`.
|
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.
|
$ go run hello-world.go // Put this code in hello-world.go,
|
||||||
Hello world
|
Hello world // then use `go run` to run it.
|
||||||
*/
|
*/
|
||||||
|
@ -6,6 +6,12 @@ func main() {
|
|||||||
var x string
|
var x string
|
||||||
x = "first"
|
x = "first"
|
||||||
fmt.Println(x)
|
fmt.Println(x)
|
||||||
x = "second"
|
x = "second" // You can mutate variables in Go.
|
||||||
fmt.Println(x)
|
fmt.Println(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
$ go run mutation.go
|
||||||
|
first
|
||||||
|
second
|
||||||
|
*/
|
||||||
|
@ -3,6 +3,14 @@ package main
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
x := "Hello World"
|
x := "Hello literal" // `x := val` is shorthand for `var x type = val`.
|
||||||
fmt.Println(x)
|
fmt.Println(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
$ go run literal.go
|
||||||
|
Hello literal
|
||||||
|
*/
|
||||||
|
|
||||||
|
// == todo
|
||||||
|
// literal?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user