Merge pull request #316 from appleboy/patch-2

fix: coding style and file format for chapter 5
This commit is contained in:
无闻
2017-02-10 23:23:57 -05:00
committed by GitHub
8 changed files with 162 additions and 153 deletions

View File

@@ -7,6 +7,7 @@ func main() {
fmt.Printf("the complement of %b is: %b\n", i, ^i) fmt.Printf("the complement of %b is: %b\n", i, ^i)
} }
} }
/* Output: /* Output:
the complement of 0 is: -1 the complement of 0 is: -1
the complement of 1 is: -10 the complement of 1 is: -10

View File

@@ -12,5 +12,7 @@ func main() {
START: START:
fmt.Printf("The counter is at %d\n", i) fmt.Printf("The counter is at %d\n", i)
i++ i++
if i < 15 { goto START } if i < 15 {
goto START
}
} }

View File

@@ -10,6 +10,7 @@ func main() {
fmt.Println("Value of i, j, s:", i, j, s) fmt.Println("Value of i, j, s:", i, j, s)
} }
} }
/* Output: /* Output:
Value of i, j, s: 0 5 a Value of i, j, s: 0 5 a
Value of i, j, s: 1 6 aa Value of i, j, s: 1 6 aa

View File

@@ -12,6 +12,7 @@ func main() {
fmt.Println() fmt.Println()
} }
} }
/* Output: /* Output:
******************** ********************
******************** ********************

View File

@@ -8,10 +8,14 @@ func main() {
func Season(month int) string { func Season(month int) string {
switch month { switch month {
case 12,1,2: return "Winter" case 12, 1, 2:
case 3,4,5: return "Spring" return "Winter"
case 6,7,8: return "Summer" case 3, 4, 5:
case 9,10,11: return "Autumn" return "Spring"
case 6, 7, 8:
return "Summer"
case 9, 10, 11:
return "Autumn"
} }
return "Season unknown" return "Season unknown"
} }