Skip to content

Commit

Permalink
Fixes gopl-zh#3
Browse files Browse the repository at this point in the history
  • Loading branch information
chai2010 committed Feb 19, 2016
1 parent f6e06c9 commit 9787d2d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions ch2/ch2-03-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var err error
var p Point
```

和var形式声明变语句一样,简短变量声明语句也可以用来声明和初始化一组变量:
和var形式声明语句一样,简短变量声明语句也可以用来声明和初始化一组变量:

```Go
i, j := 0, 1
Expand Down Expand Up @@ -64,6 +64,3 @@ f, err := os.Create(outfile) // compile error: no new variables
解决的方法是第二个简短变量声明语句改用普通的多重赋值语言。

简短变量声明语句只有对已经在同级词法域声明过的变量才和赋值操作语句等价,如果变量是在外部词法域声明的,那么简短变量声明语句将会在当前词法域重新声明一个新的变量。我们在本章后面将会看到类似的例子。



0 comments on commit 9787d2d

Please sign in to comment.