Просмотр исходного кода

Merge pull request #161 from zouyx/master

因该方法为内部调用建议改为私有
无闻 10 лет назад
Родитель
Сommit
a8b567c5b4
2 измененных файлов с 10 добавлено и 10 удалено
  1. 3 3
      eBook/06.3.md
  2. 7 7
      eBook/06.4.md

+ 3 - 3
eBook/06.3.md

@@ -27,14 +27,14 @@ package main
 import "fmt"
 
 func main() {
-	x := Min(1, 3, 2, 0)
+	x := min(1, 3, 2, 0)
 	fmt.Printf("The minimum is: %d\n", x)
 	arr := []int{7,9,3,5,1}
-	x = Min(arr...)
+	x = min(arr...)
 	fmt.Printf("The minimum in the array arr is: %d", x)
 }
 
-func Min(a ...int) int {
+func min(a ...int) int {
 	if len(a)==0 {
 		return 0
 	}

+ 7 - 7
eBook/06.4.md

@@ -11,17 +11,17 @@ package main
 import "fmt"
 
 func main() {
-	Function1()
+	function1()
 }
 
-func Function1() {
-	fmt.Printf("In Function1 at the top\n")
-	defer Function2()
-	fmt.Printf("In Function1 at the bottom!\n")
+func function1() {
+	fmt.Printf("In function1 at the top\n")
+	defer function2()
+	fmt.Printf("In function1 at the bottom!\n")
 }
 
-func Function2() {
-	fmt.Printf("Function2: Deferred until the end of the calling function!")
+func function2() {
+	fmt.Printf("function2: Deferred until the end of the calling function!")
 }
 ```