mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-11-13 09:16:10 +08:00
Merge pull request #319 from appleboy/patch-5
fix: coding style and file format for chapter 8.
This commit is contained in:
@@ -5,13 +5,13 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var Days = map[int]string{1:"monday",
|
||||
2:"tuesday",
|
||||
3: "wednesday",
|
||||
4: "thursday",
|
||||
5: "friday",
|
||||
6: "saturday",
|
||||
7: "sunday"}
|
||||
var Days = map[int]string{1: "monday",
|
||||
2: "tuesday",
|
||||
3: "wednesday",
|
||||
4: "thursday",
|
||||
5: "friday",
|
||||
6: "saturday",
|
||||
7: "sunday"}
|
||||
|
||||
func main() {
|
||||
fmt.Println(Days)
|
||||
@@ -19,7 +19,7 @@ func main() {
|
||||
flagHolliday := false
|
||||
for k, v := range Days {
|
||||
if v == "thursday" || v == "holliday" {
|
||||
fmt.Println(v, " is the ", k , "th day in the week")
|
||||
fmt.Println(v, " is the ", k, "th day in the week")
|
||||
if v == "holliday" {
|
||||
flagHolliday = true
|
||||
}
|
||||
@@ -29,6 +29,7 @@ func main() {
|
||||
fmt.Println("holliday is not a day!")
|
||||
}
|
||||
}
|
||||
|
||||
/* Output:
|
||||
thursday is the 4 th day in the week
|
||||
holliday is not a day!
|
||||
|
||||
@@ -8,11 +8,11 @@ import (
|
||||
|
||||
func main() {
|
||||
drinks := map[string]string{
|
||||
"beer": "bière",
|
||||
"wine": "vin",
|
||||
"water": "eau",
|
||||
"coffee": "café",
|
||||
"thea": "thé"}
|
||||
"beer": "bière",
|
||||
"wine": "vin",
|
||||
"water": "eau",
|
||||
"coffee": "café",
|
||||
"thea": "thé"}
|
||||
sdrinks := make([]string, len(drinks))
|
||||
ix := 0
|
||||
|
||||
@@ -43,6 +43,7 @@ func main() {
|
||||
fmt.Printf("The french for %s is %s\n", eng, drinks[eng])
|
||||
}
|
||||
}
|
||||
|
||||
/* Output:
|
||||
The following drinks are available:
|
||||
wine
|
||||
|
||||
Reference in New Issue
Block a user