Merge pull request #108 from dbarobin/master

[Typo] Fix multiple wrong single and double quotation marks
This commit is contained in:
无闻
2015-08-06 22:56:04 +08:00
5 changed files with 9 additions and 9 deletions

View File

@@ -56,8 +56,8 @@ str := "Beginning of the string " +
拼接的简写形式 `+=` 也可以用于字符串:
```go
s := hel + lo,
s += world!
s := "hel" + "lo,"
s += "world!"
fmt.Println(s) //输出 “hello, world!”
```

View File

@@ -94,7 +94,7 @@ return y
if runtime.GOOS == "windows" {
. ..
} else { // Unix - li ke
} else { // Unix-like
. ..
}

View File

@@ -7,7 +7,7 @@
```go
for {
i = i - 1
fmt.Printf(The variable i is now: %d\n, i)
fmt.Printf("The variable i is now: %d\n", i)
if i < 0 {
break
}

View File

@@ -86,10 +86,10 @@ i := 0
for { //since there are no checks, this is an infinite loop
if i >= 3 { break }
//break out of this for loop when this condition is met
fmt.Println(Value of i is:, i)
fmt.Println("Value of i is:", i)
i++;
}
fmt.Println(A statement just after for loop.)
fmt.Println("A statement just after for loop.")
```
2.
@@ -97,7 +97,7 @@ fmt.Println(“A statement just after for loop.”)
```go
for i := 0; i<7 ; i++ {
if i%2 == 0 { continue }
fmt.Println(Odd:, i)
fmt.Println("Odd:", i)
}
```

View File

@@ -124,8 +124,8 @@ addJpeg := MakeAddSuffix(“.jpeg”)
然后调用它们:
```go
addBmp(file) // returns: file.bmp
addJpeg(file) // returns: file.jpeg
addBmp("file") // returns: file.bmp
addJpeg("file") // returns: file.jpeg
```
可以返回其它函数的函数和接受其它函数作为参数的函数均被称之为高阶函数,是函数式语言的特点。我们已经在第 6.7 中得知函数也是一种值,因此很显然 Go 语言具有一些函数式语言的特性。闭包在 Go 语言中非常常见,常用于 goroutine 和管道操作(详见第 14.8-14.9 节)。在第 11.14 节的程序中,我们将会看到 Go 语言中的函数在处理混合对象时的强大能力。