more consistent case

This commit is contained in:
Mark McGranaghan 2012-10-17 17:22:24 -07:00
parent 5b906cd049
commit fdf2b6dbce
8 changed files with 18 additions and 19 deletions

View File

@ -6,7 +6,7 @@ package main
import "fmt"
// Use `const` to declare a constant value.
const s string = "Constant"
const s string = "constant"
func main() {
fmt.Println(s)

View File

@ -1,3 +1,2 @@
$ go run constant.go
Constant
constant

View File

@ -1,9 +1,9 @@
// Our first program will print the classic "Hello world"`
// Our first program will print the classic "hello world"`
// message. Here's the full source code.
package main
import "fmt"
func main() {
fmt.Println("Hello world")
fmt.Println("hello world")
}

View File

@ -1,7 +1,7 @@
# To run the program, put the code in `hello-world.go` and
# use `go run`.
$ go run hello-world.go
Hello world
hello world
# Sometimes we'll want to build our programs into
# binaries. We can do this using `go build`.
@ -11,7 +11,7 @@ hello-world hello-world.go
# We can then execute the built binary directly.
$ ./hello-world
Hello world
hello world
# Now that we can run and build basic Go programs, let's
# learn more about the language.

View File

@ -10,7 +10,7 @@ func main() {
// Here's a basic `switch`.
i := 2
fmt.Print("Write ", i, " as ")
fmt.Print("write ", i, " as ")
switch i {
case 1:
fmt.Println("one")
@ -25,9 +25,9 @@ func main() {
// `default` case in this example as well.
switch time.Now().Weekday() {
case time.Saturday, time.Sunday:
fmt.Println("It's the weekend")
fmt.Println("it's the weekend")
default:
fmt.Println("It's a weekday")
fmt.Println("it's a weekday")
}
// `switch` without an expression is an alternate way
@ -36,9 +36,9 @@ func main() {
t := time.Now()
switch {
case t.Hour() < 12:
fmt.Println("It's before noon")
fmt.Println("it's before noon")
default:
fmt.Println("It's after noon")
fmt.Println("it's after noon")
}
}

View File

@ -1,5 +1,5 @@
$ go run switch.go
Write 2 as two
It's the weekend
It's before noon
write 2 as two
it's the weekend
it's before noon

View File

@ -9,7 +9,7 @@ import "fmt"
func main() {
// `var` declares 1 or more variables.
var a string = "Initial"
var a string = "initial"
fmt.Println(a)
// You can declare multiple variables at once.
@ -29,6 +29,6 @@ func main() {
// The `:=` syntax is shorthand for declaring and
// initializing a variable, e.g. for
// `var f string = "Short"` in this case.
f := "Short"
f := "short"
fmt.Println(f)
}

View File

@ -1,6 +1,6 @@
$ go run variables.go
Initial
initial
1 2
true
0
Short
short